python-flamegraph icon indicating copy to clipboard operation
python-flamegraph copied to clipboard

Python 3.8 support

Open jtran opened this issue 5 years ago • 2 comments

I'm getting an error running this. Seems to work fine on Python 3.7, but on 3.8, I get the following.

Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/3.8.2/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/user/.pyenv/versions/3.8.2/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/user/.pyenv/versions/my-venv-3.8.2/lib/python3.8/site-packages/flamegraph/__main__.py", line 4, in <module>
    flamegraph.main()
  File "/Users/user/.pyenv/versions/my-venv-3.8.2/lib/python3.8/site-packages/flamegraph/flamegraph.py", line 146, in main
    start_time = time.clock()
AttributeError: module 'time' has no attribute 'clock'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/my-venv-3.8.2/lib/python3.8/site-packages/flamegraph/flamegraph.py", line 99, in stop
    self.join()
  File "/Users/user/.pyenv/versions/3.8.2/lib/python3.8/threading.py", line 1006, in join
    raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started

At least for time.clock(), it seems like there are alternatives in 3.8.

jtran avatar Sep 04 '20 21:09 jtran

Fixed with https://github.com/evanhempel/python-flamegraph/pull/17

tirkarthi avatar Oct 21 '20 14:10 tirkarthi

I am still getting this error with Python 3.9. I've tried installing from pip and from git, but still getting Traceback (most recent call last): File "/usr/local/Cellar/[email protected]/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/Cellar/[email protected]/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.9/site-packages/flamegraph/__main__.py", line 4, in <module> flamegraph.main() File "/usr/local/lib/python3.9/site-packages/flamegraph/flamegraph.py", line 146, in main start_time = time.clock() AttributeError: module 'time' has no attribute 'clock' Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/flamegraph/flamegraph.py", line 99, in stop self.join() File "/usr/local/Cellar/[email protected]/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 1028, in join raise RuntimeError("cannot join thread before it is started") RuntimeError: cannot join thread before it is started

Any help?

nrauch avatar Jan 13 '21 21:01 nrauch