gprof2dot icon indicating copy to clipboard operation
gprof2dot copied to clipboard

AttributeError: 'ellipsis' object has no attribute 'items'

Open ajamato opened this issue 2 years ago • 1 comments

I encountered this when trying to run

gprof2dot -f pstats <file>

Traceback (most recent call last):
  File "/home/ajamato/.local/bin/gprof2dot", line 8, in <module>
    sys.exit(main())
  File "/home/ajamato/.local/lib/python3.9/site-packages/gprof2dot.py", line 3457, in main
    parser = Format(*args)
  File "/home/ajamato/.local/lib/python3.9/site-packages/gprof2dot.py", line 2685, in __init__
    self.stats = pstats.Stats(*filename)
  File "/usr/lib/python3.9/pstats.py", line 114, in __init__
    self.init(arg)
  File "/usr/lib/python3.9/pstats.py", line 130, in init
    self.get_top_level_stats()
  File "/usr/lib/python3.9/pstats.py", line 159, in get_top_level_stats
    for func, (cc, nc, tt, ct, callers) in self.stats.items():
AttributeError: 'ellipsis' object has no attribute 'items'

Unfortunately I can't share the file. I am not sure if its related to the input files or not. But if you have any ideas what to look for I can look at the file and share findings to help debug

From pip list: gprof2dot 2021.2.21

I also did try to load the sample pstat files on this repro, but got this error as well. Perhaps there is some reason this version can't process those files?

gprof2dot -f pstats cProfile.pstats 
error: failed to load cProfile.pstats, maybe they are generated by different python version?
gprof2dot -f pstats profile.pstats 
error: failed to load profile.pstats, maybe they are generated by different python version?

I also downloaded the standalone version and got that error as well

~/gprof2dot.py -f pstats profile.pstats 
error: failed to load profile.pstats, maybe they are generated by different python version?

/usr/bin/env python3 --version
Python 3.9.2

ajamato avatar Sep 03 '21 23:09 ajamato

The only explanation I see is different Python versions. If you used Python 2 when capturing the stat files, then try invoking gprof2dot as

python2 gprof2dot.py -f pstats cProfile.pstats

jrfonseca avatar Sep 04 '21 08:09 jrfonseca