[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Problem with pygame.image.load() and a gzip.open() stream



Paul Broadhead wrote:
Lenard Lindstrom wrote:

Which file type is out of your control, the .bmp image format or the gzip compression.

Both unfortunately.

Got it. GzipFile.seek() has no optional whence argument. pygame.image.load calls seek() with both an offset and whence, but
does not pass on the exception raised by GzipFile.seek().

Thanks for looking into this. I presume this means that if if the bug you're spotted was fixed, I'd still not be able to use the GzipFile stream.


It is not technically a bug. It's just unfortunate that GzipFile has an imcomplete implementation of seek() while pygame.image.load() passes an unnecessary whence value: 0.


2) Read the gzip file into a string and use StringIO to pass the
string to pygame.image.load().

I did try something like that then, thanks again.


GzipFile could be subclassed to providing a seek() method that takes a dummy whence argument.


--
Lenard Lindstrom
<len-l@xxxxxxxxx>