Note that there are some explanatory texts on larger screens.

plurals
  1. POOpening zipfile of unsupported compression-type silently returns empty filestream, instead of throwing exception
    text
    copied!<p>Seem to be knocking my head off a newbie error and I am not a newbie. I have a 1.2G known-good zipfile <em>'train.zip'</em> containing a 3.5G file <em>'train.csv'</em>. I open the zipfile and file itself without any exceptions (no <em>LargeZipFile</em>), but the resulting filestream appears to be empty. (UNIX <em>'unzip -c ...'</em> confirms it is good) The file objects returned by Python ZipFile.open() are not seek'able or tell'able, so I can't check that.</p> <p>Python distribution is <em>2.7.3 EPD-free 7.3-1 (32-bit)</em> ; but should be ok for large zips. OS is MacOS 10.6.6</p> <pre><code>import csv import zipfile as zf zip_pathname = os.path.join('/my/data/path/.../', 'train.zip') #with zf.ZipFile(zip_pathname).open('train.csv') as z: z = zf.ZipFile(zip_pathname, 'r', zf.ZIP_DEFLATED, allowZip64=True) # I tried all permutations z.debug = 1 z.testzip() # zipfile integrity is ok z1 = z.open('train.csv', 'r') # our file keeps coming up empty? # Check the info to confirm z1 is indeed a valid 3.5Gb file... z1i = z.getinfo(file_name) for att in ('filename', 'file_size', 'compress_size', 'compress_type', 'date_time', 'CRC', 'comment'): print '%s:\t' % att, getattr(z1i,att) # ... and it looks ok. compress_type = 9 ok? #filename: train.csv #file_size: 3729150126 #compress_size: 1284613649 #compress_type: 9 #date_time: (2012, 8, 20, 15, 30, 4) #CRC: 1679210291 # All attempts to read z1 come up empty?! # z1.readline() gives '' # z1.readlines() gives [] # z1.read() takes ~60sec but also returns '' ? # code I would want to run is: reader = csv.reader(z1) header = reader.next() return reader </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload