rkern / line_profiler

(OLD REPO) Line-by-line profiling for Python - Current repo ->
https://github.com/pyutils/line_profiler
Other
3.6k stars 254 forks source link

pstats gives "ValueError: bad marshal data (unknown type code)" #117

Closed certik closed 6 years ago

certik commented 6 years ago

This works:

$ python -m line_profiler my.lprof > log

But this fails:

$ python -m pstats my.lprof 
ValueError: bad marshal data (unknown type code)
Welcome to the profile statistics browser.
%

It should work according to the documentation:

$ python -m pstats script_to_profile.py.prof

I also tried pyprof2calltree and it gives the same exception.

I am using Python 3.6 with Conda 4.5.0 on Ubuntu 16.04.

rkern commented 6 years ago

No, the .lprof files from the line-profiler are not the same thing as the .prof files. The latter are from the regular function profiler, not the line-profiler.

kernprof also works with cProfile, its third-party incarnation lsprof, or the pure-Python profile module depending on what is available.