problem zipping a text file with zlib

Steve Holden sholden at holdenweb.com
Wed Apr 10 11:18:07 EDT 2002


"DeepBleu" <DeepBleu at DeepBleu.org> wrote in message
news:ub6dji5plutpc5 at corp.supernews.com...
>
> "Joachim Kaeber" <joachim.kaeber at imk.fraunhofer.de> wrote in message
> news:3CB2FE25.86A37EA1 at imk.fraunhofer.de...
> > DeepBleu wrote:
> >
> > > Yes, I am using zipfile (from zipfile import ZipFile).  Sorry I stated
> zlib.
> > > Still with one text file in particular, WinZip reports "missing 2
bytes"
> > > DeepBleu
> >
> > is the script run on Windows? If yes, is the zipfile opened
> > in binary mode?
> >
> The script is running on Sun Solaris with Python 2.1
>
> >>>from zipfile import ZipFile
> >>>zip_archive = ZipFile("text1.zip", "w", 8)
> >>>zip_archive.write(PathToTextFile, os.path.split(PathToTextFile)[1])
> >>>zip_archive.close()
>
> Before starting this process, I am running Unix2DOS on the text file:
> Unix2Dos TextFile TextFile
>
> Reason is that the zip file will be opened later in windows (using WinZip
> for example).
> Hope this answers your question,

Do you close the zipfile after you've finished writing it?

regards
 Steve







More information about the Python-list mailing list