Problem using Python Profiler with a Tkinter application
已回答
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?
请先登录再写评论。
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?
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.