pwaller / pyprof2calltree

Profile python programs and view them with kcachegrind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't call pyprof2calltree

SandervTilburg opened this issue · comments

I am trying to call pyprof2calltree from inside a python script like this:
Output_pstats_file = os.getcwd() + r"\pstats_files\zooi.pstats"
Output_kgrind_file = os.getcwd() + r"\kgrind_files\zooi.kgrind"
os.system("python pyprof2calltree.py -i " + str(Output_pstats_file) + " -o " + str(Output_kgrind_file))

After doing this i get the following error:
Traceback (most recent call last):
File "pyprof2calltree.py", line 386, in
sys.exit(main())
File "pyprof2calltree.py", line 333, in main
kg = CalltreeConverter(pstats.Stats(options.infile))
File "C:\Python34\lib\pstats.py", line 69, in init
self.init(arg)
File "C:\Python34\lib\pstats.py", line 83, in init
self.load_stats(arg)
File "C:\Python34\lib\pstats.py", line 97, in load_stats
self.stats = marshal.load(f)
ValueError: bad marshal data (unknown type code)

I don't know if i am doing something wrong of its the pyprof2calltree package or pstats package. Pls help me out!

The error means that that the pstats file is not understood. It seems likely it is corrupted or in the wrong format. I'm unlikely to be able to help much here, sorry :(. I suggest poking around closely and taking a look inside the file to see what is going on, and comparing closely with any situations where it does work for you.

In general, it is difficult to help with a bug report like this since there isn't enough information for anyone else to reproduce the bug report: critically, where did the pstats file come from? How can I generate one which gives that error for myself?

I'm going to close this for now, but we can reopen it if you can express the bug in terms that someone else can reproduce it from scratch.