Menu

sys.exit crash the application

Help
Tonka
2017-04-26
2017-04-26
  • Tonka

    Tonka - 2017-04-26

    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 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

     
  • Florian Link

    Florian Link - 2017-04-26

    PythonQt::self()->setSystemExitExceptionHandlerEnabled(true)

    and then you can attach to systemExitExceptionRaised signal of PythonQt.

     
  • Tonka

    Tonka - 2017-04-26

    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
  • Florian Link

    Florian Link - 2017-04-26

    Have a closer look at the signature of the systemExitExceptionRaised signal.

     
  • Tonka

    Tonka - 2017-04-27

    Works. Would be nice if the return-code would also be available as functioncall from PythonQt::self() itself.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.