Problems decoding and writing mail attachment
edwinek
edwin at mindless.com
Mon Aug 4 03:07:29 EDT 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')
fle.write(decodedfile)
fle.close
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?
Thanks,
Edwin
More information about the Python-list
mailing list