Re: [Tutor] Reading gzip files

2008-12-01 Thread Kent Johnson
On Sun, Nov 30, 2008 at 9:42 PM, Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > Strangely, for the files that don't work I can read/print the file almost to > the end and then it falls over with the CRC error. That's because the CRC isn't checked until after the file is read; as you can see from th

Re: [Tutor] Reading gzip files

2008-11-30 Thread Dinesh B Vadhia
falls over with the CRC error. Dinesh Message: 5 Date: Mon, 1 Dec 2008 00:57:04 - From: "Alan Gauld" <[EMAIL PROTECTED]> Subject: Re: [Tutor] Reading gzip files To: tutor@python.org Message-

Re: [Tutor] Reading gzip files

2008-11-30 Thread David
David wrote: > #!/usr/bin/python > import tarfile > tFile = tarfile.open("/home/david/zip_files/zip.tar.gz", "r") > for f in tFile.getnames(): > print f > tFile.close() > #fname = "out.txt" > #fobj = open(fname, 'w') > #for line in f: > #fobj.write(line + '/n') > #tFile.close() > #fobj

Re: [Tutor] Reading gzip files

2008-11-30 Thread David
Dinesh B Vadhia wrote: > I'm reading gzip files and writing the content out to a text file line > by line. The code is simply: > > import gzip > list_zipfiles = dircache.listdir(zipfolder) > writefile = "out_file.txt" > fw = open(writefile, 'w') > > for ziparchive in list_zipfiles: > zfil

Re: [Tutor] Reading gzip files

2008-11-30 Thread Alan Gauld
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote I'm reading gzip files and writing the content out to a text file line by line. File "C:\Python25\lib\gzip.py", line 275, in _read self._read_eof() File "C:\Python25\lib\gzip.py", line 311, in _read_eof raise IOError, "CRC check failed" IOErr

[Tutor] Reading gzip files

2008-11-30 Thread Dinesh B Vadhia
I'm reading gzip files and writing the content out to a text file line by line. The code is simply: import gzip list_zipfiles = dircache.listdir(zipfolder) writefile = "out_file.txt" fw = open(writefile, 'w') for ziparchive in list_zipfiles: zfile = gzip.GzipFile(zipfolder + ziparchive, "r