How cleanly exit Python script without killing Moneydance

Stuart Beesley (Mr Toolbox)'s Avatar

Stuart Beesley (Mr Toolbox)

06 Nov, 2020 10:43 AM

OK, so is there a clean way to abort a python script (from a sub function/method/class)? Normally one would use sys.exit(0) but this actually kills Moneydance, because python is being run as part of the core java package (I think)… So, is there a ‘special’ abort built into Moneybot to kill the script and return to Moneybot? If not, perhaps Moneybot could define a special function / class / somwthing that python scripts can call to terminate the script cleanly? At the moment I just put ABORT which of course causes the Moneybot script runner to crash… Or Raise (exception). These both abort the script, but of course will the usual stack trace etc - Not very clean. Of course I know that I can maintain a variable and keep checking that and build a complex layer of checks to get back up to the main level, but that seems like hard work.... Thoughts?

  1. System closed this discussion on 05 Feb, 2021 10:50 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac