You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cProfile and profile don't work with pygtk/pyqt and sys.exit(0) #50228
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-07-28.12:26:51.097>created_at=<Date2009-05-09.18:57:26.738>labels= ['easy', '3.8', 'type-feature', '3.7', 'docs']
title="cProfile and profile don't work with pygtk/pyqt and sys.exit(0)"updated_at=<Date2018-07-28.12:26:51.096>user='https://github.com/akkana'
I was following the steps at http://docs.python.org/library/profile.html
to try to profile a pygtk program, but it wasn't working -- I was
getting no output at all from either cProfile or profile.
The problem turned out to be that I was exiting by calling sys.exit(0),
because that's what most pygtk programs I'd seen were doing. Changing
that to gtk.main_quit() made profiling work (but it took a long time to
track that down).
Apparently the same thing happens in pyqt if you call sys.exit(0).
New changeset 937fb55 by Christian Heimes (Andrés Delfino) in branch 'master': bpo-5978: Document that profiling needs cmd/function to return (GH-7938) 937fb55
New changeset 0041d72 by Steve Dower (Andrés Delfino) in branch '3.6':
[3.6] bpo-5978: Document that profiling needs cmd/function to return (GH-8515) 0041d72
Activity
akkana commentedon May 9, 2009
I was following the steps at http://docs.python.org/library/profile.html
to try to profile a pygtk program, but it wasn't working -- I was
getting no output at all from either cProfile or profile.
The problem turned out to be that I was exiting by calling sys.exit(0),
because that's what most pygtk programs I'd seen were doing. Changing
that to gtk.main_quit() made profiling work (but it took a long time to
track that down).
Apparently the same thing happens in pyqt if you call sys.exit(0).
BreamoreBoy commentedon Jul 10, 2010
I'm note sure if this is a library bug, doc bug, external library issue or what, anyone got any true idea?
amauryfa commentedon Jul 22, 2010
Profiling only works on functions that actually return; maybe we could
add something about this fact in the documentation
tiran commentedon Jul 28, 2018
New changeset 937fb55 by Christian Heimes (Andrés Delfino) in branch 'master':
bpo-5978: Document that profiling needs cmd/function to return (GH-7938)
937fb55
miss-islington commentedon Jul 28, 2018
New changeset c6801b4 by Miss Islington (bot) in branch '3.7':
bpo-5978: Document that profiling needs cmd/function to return (GH-7938)
c6801b4
zooba commentedon Jul 28, 2018
New changeset 0041d72 by Steve Dower (Andrés Delfino) in branch '3.6':
[3.6] bpo-5978: Document that profiling needs cmd/function to return (GH-8515)
0041d72