By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,173 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,173 IT Pros & Developers. It's quick & easy.

Error in the email module documentation ?

P: n/a
Hi all,

While reading the email module documentation, I found an error in a
small example given for the as_string() method of the Message class:
Here is the given code :

(URL : http://python.org/doc/current/lib/mo...l.Message.html)

from cStringIO import StringIO
from email.Generator import Generator
fp = StringIO()
g = Generator(mangle_from_=False, maxheaderlen=60)
g.flatten(msg)
text = fp.getvalue()
The Generator constructor should take the StingIO instance as first
argument, am I wrong ?

Although this is only a small mistake, I think it should always
be fixed.

If I've missed something or if this error have already been reported,
just forget my mail.

Cheers,

--
Adrien Di Mascio
LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Adrien Di Mascio" <Ad*************@logilab.fr> wrote in message
news:ma**********************************@python.o rg...
Hi all,

While reading the email module documentation, I found an error in a
small example given for the as_string() method of the Message class:
Here is the given code :

(URL : http://python.org/doc/current/lib/mo...l.Message.html)
from cStringIO import StringIO
from email.Generator import Generator
fp = StringIO()
g = Generator(mangle_from_=False, maxheaderlen=60)
g.flatten(msg)
text = fp.getvalue()
The Generator constructor should take the StingIO instance as first
argument
Based on 12.2.3 Generating MIME documents:'''
class Generator( outfp[, mangle_from_[, maxheaderlen]])
The constructor for the Generator class takes a file-like object
called outfp for an argument. outfp must support the write() method
and be usable as the output file in a Python extended print statement.
''',
yes.
am I wrong ?
No
Although this is only a small mistake, I think it should always
be fixed.


Of course, Python docs strive for perfection. I did not find report
in Python/Doc bugs list so added to SourceForge as bug 817178
Email.message example missing arg

Terry J. Reedy
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.