Problem with gzip module and windows
Meles MELES
meles at free.fr
Sun Oct 20 13:45:47 EDT 2002
Hi,
I'm actually having a little problem with the gzip module under
Windows.
I'm currently getting some text file containing many lines, all having
the same format.
Before applying any treatment to them, I would like to stock them in a
single compressed text file.
To do this, I've written a little piece of software like this one:
import gzip
Z1=gzip.GzipFile("test.txt.gz","ab",9)
for i in listoffile:
f=open(i,"r")
for line in f.readlines():
Z1.write(line)
f.close()
Z1.close()
Under linux, this little bit of software works very well.
Under windows, it works very well the first time I launch the program
(the test.txt.gz file is created and is filled with the lines of the
other text files).
But when I launch the script a second time, it doesn't work. There is no
error message while running, but no new lines are added to the
compressed archive. I just get 2 or 3 lines of weird symbol at the end
ofthe previously imported lines.
Any ideas of what's wrong?
Best regards.
Blaise.
--
La beauté sans la grâce attire, mais elle ne sait pas retenir ;
c'est un appât sans hameçon. Maxime Planude
More information about the Python-list
mailing list