cprofilev icon indicating copy to clipboard operation
cprofilev copied to clipboard

Internal server error, how to diagnose/rectify?

Open monocongo opened this issue 6 years ago • 0 comments
trafficstars

I have profiled some code using the command

$ python -m cProfile -o report.prof script.py

I then launch cprofilev like so

$ cprofilev -f report.prof

When I go to the URL localhost I see a 500 error:

Error: 500 Internal Server Error
Sorry, the requested URL 'http://127.0.0.1:4000/' caused an error:

Internal Server Error

When I look at the console where the cprofilev was launched I see this:

Traceback (most recent call last):
  File "/home/james/miniconda3/envs/climate_profile/bin/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/home/james/miniconda3/envs/climate_profile/bin/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/home/james/miniconda3/envs/climate_profile/lib/python3.6/site-packages/cprofilev.py", line 154, in route_handler
    self.stats = Stats(self.profile)
  File "/home/james/miniconda3/envs/climate_profile/lib/python3.6/site-packages/cprofilev.py", line 75, in __init__
    self.stats = pstats.Stats(self.profile, stream=self.stream)
  File "/home/james/miniconda3/envs/climate_profile/lib/python3.6/pstats.py", line 72, in __init__
    self.init(arg)
  File "/home/james/miniconda3/envs/climate_profile/lib/python3.6/pstats.py", line 86, in init
    self.load_stats(arg)
  File "/home/james/miniconda3/envs/climate_profile/lib/python3.6/pstats.py", line 100, in load_stats
    self.stats = marshal.load(f)
ValueError: bad marshal data (unknown type code)

The cprofilev package was installed into an Anaconda environment running Python 3.6.3 using pip install.

Can anyone advise as to how I can get past this issue? Thanks in advance for any assistance.

monocongo avatar Dec 24 '18 19:12 monocongo