problem zipping a text file with zlib

DeepBleu DeepBleu at DeepBleu.org
Thu Apr 11 09:50:35 EDT 2002


"Steve Holden" <sholden at holdenweb.com> wrote in message
news:SKYs8.19881$GM.6702 at atlpnn01.usenetserver.com...
> "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?
>
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






More information about the Python-list mailing list