> im having problems when running python scripts
> 
> When running the scripts it always closes immediately

If you're running it in Windows, and running it by double clicking on a .py 
file, then it will pop up a console window while it's running, and then 
immediately close that window when the script is complete. So if the script is 
failing immediately or even succeeding quickly, then the window with all the 
output is closing immediately too.

If this is what's going on with you, you can open the console first and run the 
scripts from there. That way all their output will still be there for you to 
see when it's complete.

Alternatively as a temporary debugging solution you could surround the main 
part (or all) of the script in a try statement and in the except clause have a 
"hit enter to continue" bit to freeze it before it closes the window.


import traceback
try:
    stuff
except:
    traceback.print_exc()
    raise
finally:
    input("Hit Enter to close")

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to