PIL does not get the opportunity to load image from io.BytesIO data stream in ext/image.py
Created originally on Bitbucket by ken_long (k l)
When using using PIL, I cannot load an image file from a zipfile object (as is used in sdl2.ext.Resources), The following code produced an AttributeError, _io.BytesIO has no attribute 'encode'
I summarized the following code from my original. I haven't run this exact code in the release PySDL2, though it is how I recall initally finding the issue. I will repro it with the original code if you insist.
Example: in the /dat folder is a a zip archive, the archive contains test.png
import sdl2.ext
RESOURCES = sdl2.ext.Resources(file, "dat") factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE)
factory.from_image(RESOURCES.get("test.png"))
Fix: ln 47: if hasattr(fname, 'encode'):
prior to byteify (byteify failing leading to inability to load zipfile io.bytesio data stream)