Error Bad Marshal - runnake

I ran cProfile on a python 3 script, worked beautifully, then tried to visualize it with runnake. Howvever, I got a blank screen and a "bad marshal data" error.

I deleted the .pyc file, but that didn't work either.

The code I used to install runnake was:

sudo apt-get install python-profiler python-wxgtk2.8 python-setuptoolD sudo easy-install installSquareMap RunSnakeRun 

I am using UBUNTU.

Many thanks.

Note: I have to add that I installed everything while py3k was activated.

+8
python cprofile
source share
1 answer

I had the same problem. As far as I can tell, the RunSnakeRun package has not been ported to Python3. At least I could pass it to python2, but not to python3 (SyntaxError). Also, I think the cProfile output format is incompatible between python 2/3. I did not find time to find a final confirmation of this, but in the document cProfile class pstats.Stats (* filenames, stream = sys.stdout) , they say: "The file selected by the above constructor must be created with the appropriate version of the profile or cProfile. In particular, there is no file compatibility with future versions of this profiler, and no compatibility with files created by other profilers. " This seems to be causing your problem. For example, I made a profile obtained from python3

 import cProfile cProfile.run('some code to profile', 'restats') 

and tried to open it in RunSnakeRun and got the same marshal error as you. Also, if I do

 import pstats p = pstats.Stats('restats') p.strip_dirs().sort_stats(-1).print_stats() 

in python3, it works like a charm. If I do this in python2, it will give a marshal error. Now RunSnakeRun is executed in python2 (if you have not found a way to run it in python3). So, I assume that you have completed your profiling in python3 and are using tools relying on python2 to analyze them, which tools expect the output to be compatible with python2.

The RunSnakeRun project seems to be inactive for a while (copyrights to pyprof2calltree in combination with KCachegrind worked fine for me on Linux. It can provide a similar visual view of the profiling output as you could get from RunSnakeRun.

+5
source share

All Articles