i have some troubles when my script is call sys.exit() (call could also by call from modules like argparse). There problem is that this crash my application (throws an SystemExit exception). If google about that problem and it seems to be a problem if the python interpreter is embedded. I coud call os.exit(), but this does not work if i have indirect calls like argparse.
Is there a good solution for that in PythonQt
Thanks in advance
Tonka
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey,
i have some troubles when my script is call
sys.exit()
(call could also by call from modules like argparse). There problem is that this crash my application (throws an SystemExit exception). If google about that problem and it seems to be a problem if the python interpreter is embedded. I coud callos.exit()
, but this does not work if i have indirect calls like argparse.Is there a good solution for that in PythonQt
Thanks in advance
Tonka
PythonQt::self()->setSystemExitExceptionHandlerEnabled(true)
and then you can attach to systemExitExceptionRaised signal of PythonQt.
This works. How can i get the value of sys.exit(100) (i mean the 100)? Or is it only possible to get it per the signal itself=
Last edit: Tonka 2017-04-26
Have a closer look at the signature of the systemExitExceptionRaised signal.
Works. Would be nice if the return-code would also be available as functioncall from PythonQt::self() itself.