-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
In my script, I use profiling to keep track:
if __name__ == '__main__':
pr = Profile()
pr.enable()
#...
#My code
#...
pr.disable()
s = io.StringIO()
sortby = pstats.SortKey.CUMULATIVE
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
ps.dump_stats("../run.prof")
If I encounter an error and this script doesn't run to completion, and I try to run again (after fixing the problem but that's not required here), I encounter this error at the pr.enable() line.
ValueError: Another profiling tool is already active
At this point, even if I run pr.disable() or even del pr, this error never goes away. The only thing that works is to restart the kernel itself.
Is this a bug? Is this a bad practice that I should not do (if so, what's the standard practice?)?
Metadata
Metadata
Assignees
Labels
No labels