Problem using Python Profiler with a Tkinter application

Answered

I've got an app I've written in tk. I'm trying to see what code is bottlenecking my GUI update function. However, when I click on the `Run selected configuration with Python profiler`, the code just runs normally, like I clicked `Run`. Normally, after an exit, the profiler will show its' report, but no such thing happens.

The only thing I can maybe think of is that my `on_closing` function is killing the profiler thread somehow.

def on_closing(self):
self.logger.info('Shutting down.\n')
self.master.destroy()
os._exit(1)

What else would cause the profiler to not display results?

0
2 comments

Hi Samtq3! os._exit prevents the profiler to display the results. I created a ticket in our bug tracker: https://youtrack.jetbrains.com/issue/PY-30303

Meanwhile, could you please elaborate on why do you use os._exit instead of e.g. sys.exit?

0
Avatar
Permanently deleted user

Pavel,

I'm using os._exit somewhat naively. I am using a windows System Tray Icon for the app I'm developing (something like this). sys.exit doesn't kill the tray icon, and I have to Right-Click -> Exit. On it to quit the program completely. The tray icon is running in a different thread, if that matters.

0

Please sign in to leave a comment.