Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read prof file from WSGI Application Profiler #33

Closed
stephenrs opened this issue Oct 27, 2018 · 3 comments
Closed

Unable to read prof file from WSGI Application Profiler #33

stephenrs opened this issue Oct 27, 2018 · 3 comments

Comments

@stephenrs
Copy link

When I run "tuna <profile_output>.prof" I get the following:

Traceback (most recent call last):
  File "/Users/stephen/www/profiling/venv3/bin/tuna", line 11, in <module>
    sys.exit(main())
  File "/Users/stephen/www/profiling/venv3/lib/python3.6/site-packages/tuna/cli.py", line 33, in main
    start_server(args.infile, args.browser)
  File "/Users/stephen/www/profiling/venv3/lib/python3.6/site-packages/tuna/main.py", line 172, in start_server
    data = read(prof_filename)
  File "/Users/stephen/www/profiling/venv3/lib/python3.6/site-packages/tuna/main.py", line 33, in read
    return read_runtime_profile(filename)
  File "/Users/stephen/www/profiling/venv3/lib/python3.6/site-packages/tuna/main.py", line 37, in read_runtime_profile
    stats = pstats.Stats(prof_filename)
  File "/usr/local/Cellar/python/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pstats.py", line 72, in __init__
    self.init(arg)
  File "/usr/local/Cellar/python/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pstats.py", line 86, in init
    self.load_stats(arg)
  File "/usr/local/Cellar/python/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pstats.py", line 100, in load_stats
    self.stats = marshal.load(f)
ValueError: bad marshal data (unknown type code)

Also, the same files load fine in SnakeViz, but obviously I'm interested in the advanced features of Tuna.

Python v3.6.1
MacOS 10.13.5

Any suggestions would be greatly appreciated.

@stephenrs
Copy link
Author

Actually, it looks like the problem is that I'm trying to read a prof file that was created from a python2.7 app/venv...but when I try to start Tuna in a Python2.7 venv I get the following error:

Traceback (most recent call last):
  File "/Users/stephen/www/wavebasis/venv/bin/tuna", line 7, in <module>
    from tuna.cli import main
  File "/Users/stephen/www/wavebasis/venv/lib/python2.7/site-packages/tuna/__init__.py", line 13, in <module>
    from . import cli
  File "/Users/stephen/www/wavebasis/venv/lib/python2.7/site-packages/tuna/cli.py", line 10, in <module>
    from .main import start_server, read, render
  File "/Users/stephen/www/wavebasis/venv/lib/python2.7/site-packages/tuna/main.py", line 3, in <module>
    from http.server import HTTPServer, BaseHTTPRequestHandler
ImportError: No module named server

Is there a way to get Tuna running in Py2.7, or is it Py3.x only?

Thanks

@nschloe
Copy link
Owner

nschloe commented Oct 31, 2018

Well, looks like tuna needs Python 3. I wouldn't mind a PR that fixes it for Python 2 though. One probably needs SimpleHTTPServer for that.

@nschloe
Copy link
Owner

nschloe commented Mar 11, 2019

Actually, considering the fact that Python 2 will be unsupported in a few months, let's not start supporting it now.

Python 2 profiles can be displayed with tuna nonetheless, of course.

@nschloe nschloe closed this as completed Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants