2

I wrote a script in python with a wx.Frame, and it has an exit function that calls sys.exit() when the user has clicked the close button. I'd like to be able to run this script from iPython, but when the user clicks the close button, sys.exit() kills the running python script as well as iPython. What could I use in place of sys.exit() to kill only the python script, not iPython?

Thanks!

1 Answer 1

1

I am not familiar with iPython but with a little searching I found a page: http://ipython.scipy.org/moin/InterupptingThreads, I infer from this that all you might have to do is "raise SystemExit".

Sign up to request clarification or add additional context in comments.

1 Comment

Useful, but I would like to mention that sys.exit is equivalent to raising a SystemExit; it says so if you run help(sys.exit). Not entirely sure why this works for me but not the OP

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.