Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2
Nils Bunger
nilsbunger at gmail.com
Thu Sep 26 00:23:21 EDT 2013
Chris,
Thanks for answering.
Yes, it's email.mime.MIMEApplication. I've pasted a snippet with the imports below.
I'm trying to use this to build a multi-part MIME message, with this as one part.
I really can't figure out any way to attach a binary part like this to a multi-part MIME message without the encoding issue... any help would be greatly appreciate!
Nils
---------
import io
from email.mime.application import MIMEApplication
from email.generator import BytesGenerator
from email.encoders import encode_noop
app = MIMEApplication(b'Q\x0dQ', _encoder=encode_noop)
b = io.BytesIO()
g = BytesGenerator(b)
g.flatten(app)
for i in b.getvalue()[-3:]:
print("%02x " % i, end="")
print()
On Wednesday, September 25, 2013 9:11:31 PM UTC-7, Chris Angelico wrote:
> On Thu, Sep 26, 2013 at 2:38 AM, <nilsbunger at gmail.com> wrote:
>
> > app = MIMEApplication(b'Q\x0dQ', _encoder=encode_noop)
>
>
>
> What is MIMEApplication? It's not a builtin, so your test case is
>
> missing an import, at least. Is this email.mime.MIMEApplication?
>
>
>
> ChrisA
More information about the Python-list
mailing list