Re: Windows gzip problem
- From: John Earls <yt.rabb@xxxxxxxxx>
- Date: Thu, 28 Feb 2008 19:45:22 -0800 (PST)
On Feb 28, 6:57 pm, "Gabriel Genellina" <gagsl-...@xxxxxxxxxxxx>
wrote:
En Thu, 28 Feb 2008 21:09:30 -0200, John Earls <yt.r...@xxxxxxxxx>
escribió:
I am having a problem with gzip. The code worked fine under linux but
when I moved it over to windows it is getting stuck unzipping a gz
file.
-- snippet --
fileObj = gzip.GzipFile(iceGetter.file.localFileName, 'rb')
uncompressedFileName = iceGetter.file.localFileName[:-3]
output = open(uncompressedFileName, 'wb')
output.write(fileObj.read())
output.close()
fileObj.close()
-- snippet --
typing "python autoIce.py" gets this error:
--error--
Traceback(most recent call last):
File "runAuto.py", line 17 in ?
output.write(fileObj.read())
File "C:\Python24\lib\gzip.py". line 217 in read
self._read(readsize)
File "C:\Python24\lib\gzip.py", line 276 in _read
uncompress.decompress.decompress(buf)
Memory Error
Is the uncompressed file big? Instead of output.write(fileObj.read())
--that reads the whole contents in memory-- try
shutil.copyfileobj(fileObj, output)
--
Gabriel Genellina
That worked perfectly.
Thank you so much.
.
- References:
- Windows gzip problem
- From: John Earls
- Re: Windows gzip problem
- From: Gabriel Genellina
- Windows gzip problem
- Prev by Date: Re: (Newbie) Help with sockets.
- Next by Date: Re: How about adding rational fraction to Python?
- Previous by thread: Re: Windows gzip problem
- Next by thread: How to configure Python in Windows
- Index(es):
Relevant Pages
|