-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
_png.read_png crashes on Python 3 with urllib.request object #1650
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
Conversation
…s. Use npy_PyFile_* compatibility methods instead of rolling it ourselves.
Thanks for the tip about |
Thanks, that was fast. It does work for me. Verified with matplotlib-1.2.0.win-amd64-py3.3.exe. |
Ugh... I didn't realise -- it appears that npy_PyFile_CloseFile is only in Numpy 1.7. That's not going to fly. The other functions go back to 1.5.0, which is better, but still higher than the 1.4.0 which is our current minimum requirement. I guess we copy these over to our own tree? I'd hate to do that... |
This needs more testing. In IPython 0.13.1 notebook on Python 3.3 now I get:
|
…n-real" file objects.
Ok -- seems to be reproduceable on Python 3.2 as well, with IPython 0.13. IPython git master fails to display inline plots on Python 3.x for an apparently unrelated reason. In any case, I have a fix for this. When a "fake" file object (such as a BytesIO here) is passed in, |
I just noticed that files are not opened in binary mode for reading and writing. I think for Windows the file open modes must be |
Good catch. I've updated the PR to open the files in binary mode. |
_png.read_png crashes on Python 3 with urllib.request object
@mdboom - have you done a merge back to master recently? I haven't - it's probably a good idea to get on top of that hurdle as soon as we can if you haven't either. |
I did this a few times yesterday, and it seems we're caught up at the moment. I agree with you -- it's usually best to merge as soon as possible to avoid large, complex conflicts. |
The following code crashes on Python 3.x but not on Python 2.x (verified on Windows with mpl 1.2.0):
The crash is at _png.cpp line 328
Maybe using numpy's
npy_PyFile_*
functions could help. A lot of thought has gone into those functions.