Skip to content

Commit

Permalink
Use cProfile instead of profile
Browse files Browse the repository at this point in the history
I can't open .prof files created with 'profile' using pyprof2calltree:

```
Traceback (most recent call last):
  File "/home/val/.local/bin/pyprof2calltree", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/val/.local/lib/python3.11/site-packages/pyprof2calltree.py", line 339, in main
    kg = CalltreeConverter(pstats.Stats(args.infile))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/val/.local/lib/python3.11/site-packages/pyprof2calltree.py", line 178, in __init__
    self.entries = pstats2entries(profiling_data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/val/.local/lib/python3.11/site-packages/pyprof2calltree.py", line 135, in pstats2entries
    cc, nc, tt, ct = call_info
    ^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable int object
```
  • Loading branch information
progval committed Aug 2, 2024
1 parent bb120ed commit 72e90b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scripts/limnoria.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ def removePidFile():
owner = Owner.Class()

if options.profile:
import profile
import cProfile
world.profiling = True
profile.runctx('run()',
globals=globals(), locals={**locals(), "run": run},
filename='%s-%i.prof' % (nick, time.time()))
cProfile.runctx('run()',
globals=globals(), locals={**locals(), "run": run},
filename='%s-%i.prof' % (nick, time.time()))
else:
run()

Expand Down

0 comments on commit 72e90b6

Please sign in to comment.