zip/unzip pictures doesn't work 
Author Message
 zip/unzip pictures doesn't work

I've been messing around with the zipfile module and discovered
something strange.
When I zip/unzip ordinary text files there's no problem but when i use
pictures (JPG and GIF) they get corrupted. I believe it is during the
unzip operation they get messed up.
I've zipped with python, unzipped with python -> doesn't work.
Zipped with Winzip, unzipped with python -> doesn't work.
Same as above but unzipped with Winzip -> OK.

Is there something special you have to consider when unzipping a picture?

/Ando N



Wed, 27 Apr 2005 18:40:51 GMT  
 zip/unzip pictures doesn't work

Quote:

> I've been messing around with the zipfile module and discovered
> something strange.
> When I zip/unzip ordinary text files there's no problem but when i use
> pictures (JPG and GIF) they get corrupted. I believe it is during the
> unzip operation they get messed up.

Sniff, sniff.  I smell a text/binary distinction (and I see you're on
Windows).  Make sure you open the relevant files in binary mode by
appending a 'b' character to the mode string.

--

 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Success and failure are equally disastrous.
\__/ Tennessee Williams
    The laws list / http://www.alcyone.com/max/physics/laws/
 Laws, rules, principles, effects, paradoxes, etc. in physics.



Wed, 27 Apr 2005 18:49:12 GMT  
 zip/unzip pictures doesn't work
You're right! Thanks!
My first (failed) attempts were made on a Win NT.
Now I'm back on my own trustworthy linux machine and, hey, it works!
Quote:


>>I've been messing around with the zipfile module and discovered
>>something strange.
>>When I zip/unzip ordinary text files there's no problem but when i use
>>pictures (JPG and GIF) they get corrupted. I believe it is during the
>>unzip operation they get messed up.

> Sniff, sniff.  I smell a text/binary distinction (and I see you're on
> Windows).  Make sure you open the relevant files in binary mode by
> appending a 'b' character to the mode string.



Wed, 27 Apr 2005 19:01:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ZIP: Are there any generally avail unzip zip classes

2. Need a zip util to unzip msdos zipped files on a unix plat

3. BLT installs but doesn't work, and TkTable doesn't build

4. EAI works (or doesn't work) differently under different platforms

5. tkman works/doesn't work [hpux9]

6. Zip/Unzip-Routine for Strings

7. zip/unzip files from Clarion application

8. What Fun It Is To ZIP (and UnZip)

9. ZIP/UNZIP-Routine for Strings

10. Most efficient unzip - inverse of zip?

11. Anyone managed to unzip mstcl73e.zip ?

12. match works, don't match doesn't

 

 
Powered by phpBB® Forum Software