Can I debug PyQt application when is main loop running ? Pdb, NetBeans, PyDev, all "freeze" when sys.exit(app.exec_()) is executed. I probably missing something obvious. Or what can be problem, please ? I apologize for my "creepy" english. Thanks.
Asked
Active
Viewed 6,454 times
1
-
Probably not the cleanest way to do it, but I like the embed() function from the IPython library. It basically opens up IPython wherever you place the embed() function and allows you to access your variables and stuff there. Unfortunately, unlike a real debugger, you can't go through your code line by line. – Dargscisyhp May 11 '20 at 15:22
1 Answers
1
I'm assuming your main()
function looks something like this:
def __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
myapp = MyApplication()
myapp.show()
sys.exit(app.exec_())
If not, post some example code to help determine what coudl be wrong.
If that is what your code looks like, you can debug any part of you program using IDLE (included in Python install). Once in IDLE, goto Debug-->Debugger to turn DEBUGGING ON.
Then open your .py file, and run it (F5). You can set breakpoints by right-clicking on any line in the file, and choosing Set Breakpoint.
Check this other SO question for more info and good links to alternative debuggers/IDEs:

Community
- 1
- 1

Jason Coon
- 17,601
- 10
- 42
- 50
-
Thanks for link to another SO question - there accepted answer discusses winpdb + links to winpdb tutorial - it's all you need if you experience "freezing" of you main PyQt loop. – Victor Farazdagi May 24 '10 at 02:41