How to make Python executable pause when it raises an error? -
so know can make python executable using pyinstaller
.
however, every time raises error, instantly end program, can't find error.
i know can use time.sleep(30000)
stop it.
but if code raises error before meets time.sleep(30000)
, shut down.
to sum up, how make keep not shutting down, can see mistake?
if running executable double clicking, try running console. e.g. in windows:
in cmd, run
cd executable_path myexecutable.exe
a better way introduce logger other modules logging implemented can write files.
also, can put code in try-except block:
try: #my_code_here print('here exception is') except exception e: print('unexpected error:' + str(e))
Comments
Post a Comment