Error on mimetools?

Arnulf Heimsbakk arnulf at spirea.net
Mon Jul 30 08:56:48 EDT 2001


I'm using only the raw base64 text. It is the same text I used in my winzip
experiment and in python test program I've made. It works in winzip but not
with python code. As I mentioned python gives me a file slightly bigger than
winzip. It's about 300 bytes bigger.

I'm without clues to this one. It does not seem to be any logic in the
error.

Arnulf

"Martin von Loewis" <loewis at informatik.hu-berlin.de> wrote in message
news:j4puair3bb.fsf at informatik.hu-berlin.de...
> "Arnulf Heimsbakk" <arnulf at spirea.net> writes:
>
> > I'm trying to decode a mime64 message in python with mimetools. I have
> > tested the "body" with windows winzip. It decodes correctly. When I try
to
> > decode it in python, it do not decode correctly. I get a file with
slightly
> > increased size. The heading of the file seems the same, but when I test
this
> > with a jpg file - the file gets corrupted when decoded with python's
> > mimetools.
> >
> > Is there a error in mimetools? Or is my approach entirly incorrect. My
code
> > is below:
> >
> > out = StringIO()
> > mimetools.decode(StringIO(self.body), out,  'base64')
> > return out.getvalue()
>
> It very much depends on what self.body is in this context. To use
> mimetools.decode, you must be sure that it is the raw base64 bytes,
> i.e. without any headers and trailers.
>
> Regards,
> Martin
>





More information about the Python-list mailing list