debugging - Mutlithreaded python application not hitting breakpoints in Visual Studio -
i developing pyqt application in visual studio. debugging has been working great, until decided keep ui responsive moving stuff worker thread qt threads.
class mainwindow(base, form): start_work = qtcore.pyqtsignal() def __init__(self, parent=none): # create seperate thread in update information polled. self.thread = qtcore.qthread() # create worker object , move new thread self.worker = worker() self.worker.movetothread(self.thread) # connect signal start work in tread self.start_work.connect(self.worker.get_work_done) self.thread.start() #function emit signal start doing work def do_work(self): self.startwork.emit()
any function invoked on worker object connected via signal slots
class worker(qtcore.qobject): @qtcore.pyqtslot() def get_work_done(self): #lets time consuming work.
the code works fine. problem now, cannot debug happening inside get_work_done
. visual studio won't break @ breakpoints.
when break inside mainwindow
function, visual studio debugger shows 1 thread. seems unaware of other threads created application. has had similar problems , knows how solve it?
debugger needs play tricks detect new threads , set hooks (which needed hit breakpoints etc). hijacking standard python _thread
module. if you're creating threads in way circumvents module altogether, suspect qt here, debugger not aware of threads.
try using standard threading
module instead of qthread
, , see if helps.
Comments
Post a Comment