problem zipping a text file with zlib

Steve Holden sholden at holdenweb.com
Thu Apr 11 12:41:34 EDT 2002


"DeepBleu" <DeepBleu at DeepBleu.org> wrote in message
news:ubb56d6fvmpjf0 at corp.supernews.com...
>
[ ... ]
> >
> > Do you close the zipfile after you've finished writing it?
> >
> Do you mean text1.zip (from the code above) as the zipfile to be closed?
> No, I am not!  I thought it was enough to close the ZipFile instance
> (zip_archive).  Since text1.zip makes its appearance (first used) in:
> >>>zip_archive = ZipFile("text1.zip", "w", 8)
> How do I close the text1.zip (if that is the one you are refering to)?
> DeepBleu
>
Ignore me. It was obvious in the code you gave that you are indeed correctly
closing the file after writing it.

Since the zipfile format is binary, you should *not* be running Unix2DOS to
convert it - you are probably messing up the file format by doing that, and
may well find everything works fine if you just transfer the file across to
Windows as a binary image.

Unix2DOS will translate LF in the input into CR/LF in the output. WinZip (or
whatever) won't expect that, and your file will be hosed. The file that
works possibly just doesn't compress down to something containing newlines.


regards
 Steve







More information about the Python-list mailing list