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

Support for Py3.x #5

Closed
dizcza opened this issue Mar 27, 2017 · 2 comments
Closed

Support for Py3.x #5

dizcza opened this issue Mar 27, 2017 · 2 comments

Comments

@dizcza
Copy link

dizcza commented Mar 27, 2017

Does supporting Python >= 2.7 mean that I can run this tool for Py3.6?
This is purely py2 --> py3 encoding problem.

$ stackcollapse-hprof mymem.hprof > output-folded.txt

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/stackcollapse-hprof", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/stackcollapse_hprof.py", line 183, in main
    content  = get_file_content(filename)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/stackcollapse_hprof.py", line 58, in get_file_content
    lines = f.readlines()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd6 in position 87: ordinal not in range(128)
@cykl
Copy link
Owner

cykl commented Mar 27, 2017

Does supporting Python >= 2.7 mean that I can run this tool for Py3.6?

Yes, it should. Travis CI is configured to run the test suite with Python 3.2 .. 3.5.

This is purely py2 --> py3 encoding problem.

I assumed that hprof ASCII output was... ASCII. However, it is not. It seems to be... UTF-8 encoded. (I played LC_ALL and LANG and always got an UTF-8 encoded file but I am not fully confident that the file will always be UTF-8 encoded).

I will push a fix tomorrow.

However, I am a bit puzzled by position 87. 87 should be in the header part which is pure ASCII. Would you mind sharing your hprof file?

@cykl cykl closed this as completed in 7dd8106 Mar 27, 2017
@dizcza
Copy link
Author

dizcza commented Mar 28, 2017

Sorry, I can't upload this snapshot - it's 500 Mb and I don't know what sensitive information could be there. I created it with Pycharm --> Tools --> Create Memory Snapshot, you can try to do it yourself. It's a tool for addressing Pycharm memory issues, so it's probably not meant to be used with third party packages like yours.

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