[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Debugging multithreaded code
From:       Håkon_Bertheussen <haakon.bertheussen () gmail ! com>
Date:       2009-02-28 15:48:05
Message-ID: dc766ac10902280748u4efc416cw6ce56dbbcfcac064 () mail ! gmail ! com
[Download RAW message or body]

I'm having a problem with debugging a piece of code that's being run
in a separate QThread. Specifically, any breakpoints I set in this
code will not be triggered. I've tried with both PyDev and pdb. This
is on Windows using Python 2.6.1 and PyQt 4.4.4.

See below for an example:

(main.py)

from PyQt4.Qt import *
import signal

class MyThread(QThread):
   def run(self):
       print "Hello World" # attempting to break at this line

def main():
   app = QApplication([])
   signal.signal(signal.SIGINT, signal.SIG_DFL) # exit on ctrl-c
   thread = MyThread()
   thread.start() # prints "Hello World", but no breakpoint encountered!
   return app.exec_()

if __name__=='__main__':
   main()

-------
Testing with pdb:

C:\pytest\src>python -m pdb main.py
> c:\pytest\src\main.py(1)<module>()
-> from PyQt4.Qt import *
(Pdb) b 6
Breakpoint 1 at c:\users\haakon\workspace\pytest\src\main.py:6
(Pdb) c
Hello World
^C
C:\pytest\src>
-------

As you can see, the breakpoint never triggered. I can set breakpoints
on code that runs in the main thread just fine.

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic