MIME coding problems

Fredrik Lundh fredrik at pythonware.com
Thu Jul 15 13:36:35 EDT 1999


<sennomo at my-deja.com> wrote:
> I am having problems with MIME encoding and decoding.  The following
> code is supposed to take a binary file, base64-encode it, then decode
> the encoded form, producing a copy of the original file.  Can anyone
> explain to me why it doesn't work?
> 
> ------------------------------------------
> import mimetools
> 
> # open a binary file for reading
> input_file = open("any.gif", 'r')

the comment doesn't match the code. try:

input_file = open("any.gif", 'rb')

('b' for binary, see the library reference for
more information on the "open" function).

</F>





More information about the Python-list mailing list