PyCharm not debugging into new Thread

I'm using PyCharm Community Edition 2020.1.2 on Windows 10 and I try to debug a Python 3.7 Toga project, created with the BeeWare 'briefcase new' command. The app is set up as a module and I can debug into it, until I get to Toga.App.main_window.main_loop(). There, a new thread for the app execution is created and the app's main window is displayed.

The debugger stops there and waits for the main_loop() to end and no breakpoint in my app code has any effect. Then, when main_loop ends, debugging resumes. But I want to debug the newly created thread, because that is where my app code is actually executed. I would have expected to see the new Thread under 'Frames',so that I could change to this thread to continue debugging. But under 'Frames', I first only see 'MainThread' and when main_loop() is executed, there is nothing in 'Frames' anymore until I close the app's main window. Then, again, 'MainThread' is displayed.

This is the code executed in main_loop():

def main_loop(self):
  thread = Threading.Thread(Threading.ThreadStart(self.run_app))
  thread.SetApartmentState(Threading.ApartmentState.STA)
  thread.Start()
  thread.Join()

Debugging works fine for apps using tkinter for example. A colleague told me that Toga debugging is working on his Mac but he has the same problem under Windows.

Please help

4 comments
Comment actions Permalink

I am experiencing the same issue with PyCharm Pro. My app is not using any threading whatsoever. I tried debugging the same app on both macOS and Windows 10. On macOS, I can debug normally, but on Windows 10, PyCharm ignores my breakpoints.

0
Comment actions Permalink

pycharm pro debug is freezing when starting a new thread , using tkinter as GUI. 2020.1.4. It seems to be intermittent.  I will submit a ticket 

0
Comment actions Permalink

I would suggest trying 2020.2 first and then submit a ticket if the issue is still there.

https://www.jetbrains.com/pycharm/download

0
Comment actions Permalink

thanks, tried that , same behaviour. Simple example sent me by support works fine, so something specific to my code. what it is doing is creating a tkinter window  to monnito progress of a job in the main thread (all that tkinter will allow) , then creating another thread to run the job in. on switching to that, everything freezes. I will continue dialog with support 

0

Please sign in to leave a comment.