When running PyQt5 app in Spyder it always exits with -1

前端 未结 1 1242
梦如初夏
梦如初夏 2020-12-10 22:29

I am learning to program with PyQt5. No troubles with that, but there is one annoying issue: when I start the app, I immediately get the message that an exception occurred a

相关标签:
1条回答
  • 2020-12-10 23:04

    (Spyder maintainer here) When you run programs in Spyder you're doing it in interactive mode, meaning that you don't need to add a sys.exit call at the end of them, because that simply tries to kill the process responsible for running your code.

    That's precisely what this warning is telling you:

    warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
    

    It means that to exit an IPython session you need to follow one of the above methods, instead of using sys.exit.

    The solution to this problem (which has been asked a lot of times already) is in our wiki.

    0 讨论(0)
提交回复
热议问题