Problems extracting attachment from email

Lee Harr lee at example.com
Thu Apr 7 16:13:42 EDT 2005


On 2005-04-07, foten <valinor at linuxmail.org> wrote:
> The problem I'm having is when I'm trying to extract the
> attachement using
>         f=open(Filename, "wb")
>         f.write(msg.get_payload(decode=1))
>         f.close()
> Not the whole message is decoded and stored!
> When only trying
>         f.write(msg.get_payload())
> I see that the last 255 bytes are missing.
>


What happens if you do...

m = msg.get_payload(decode=1)
f.write(m)
f.write(m)
f.close()
?

Just wondering if maybe some buffer not
being flushed properly.

Maybe could replace the 2nd f.write()
with an f.flush()



More information about the Python-list mailing list