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

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



On Thu, Feb 15, 2007 at 09:54:36PM +0000, Paul Broadhead wrote:
> I have a bmp image file that loads fine with:
> 
> fid = open('test.bmp','rb')
> theimg = pygame.image.load(fid)
> fid.close()
> 
> but if I gzip the image using "gzip test.bmp" then try
> 
> fid = gzip.open('test.bmp.gz','rb')
> theimg = pygame.image.load(fid)
> fid.close()
> 
> I get an error:
> theimg = pygame.image.load(fid)
> pygame.error: File is not a Windows BMP file

My guess would be that pygame tries to seek around the file, but cannot
do so.  (It may be a completely wrong guess, because I would expect an
exception rather than this sort of error.)

Why do you want a gzipped bmp file rather than a png?

Marius Gedminas
-- 
He who sacrifices functionality for ease of use
Loses both and deserves neither

Attachment: signature.asc
Description: Digital signature