Problems decoding and writing mail attachment

edwinek edwin at
Mon Aug 4 09:07:29 CEST 2003

I've written a script which I use to save attached binary files from
e-mails to disk. The core is simply:

decodedfile = bas64.decodestring(attachment)
fle = open('image.jpg','wb')

However, the files written to disk are regularly incomplete, i.e.
jpg's having a grey bar at the bottom, gif's don't even display, pdf's
give errors.
What am I doing wrong here?


More information about the Python-list mailing list