Page 1 of 1

How to quietly exit a runfile script?

Posted: 30 Apr 2025, 23:13
by Anonymous
I am using Spyder 6 console to invoke a Python script via the runfile command. After a recent Anaconda update, I found that sys.exit() no longer exits the script quietly. It prints:

Code: Select all

An exception has occurred, use %tb to see the full traceback.

SystemExit: 0

C:\Users\User.Name\AppData\Local\anaconda3\envs\py39\lib\site-packages\IPython\core\interactiveshell.py:3534: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
Verwenden von exit () und befreit () sind gleich ausführlich. Ich möchte os._exit () vermeiden, da es Säuberungshandler überspringt.>