problem zipping a text file with zlib

DeepBleu DeepBleu at DeepBleu.org
Tue Apr 9 14:44:02 EDT 2002


"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,
DeepBleu





More information about the Python-list mailing list