Author rurpy2
Recipients docs@python, rurpy2
Date 2013-07-29.06:27:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375079228.82.0.247789886969.issue18584@psf.upfronthosting.co.za>
In-reply-to
Content
In the first example in the documentation for library module email.policy (http://docs.python.org/3/library/email.policy.html#module-email.policy):

  >>> from email import msg_from_binary_file
  >>> from email.generator import BytesGenerator
  >>> from subprocess import Popen, PIPE
  >>> with open('mymsg.txt', 'b') as f:
  ...     msg = msg_from_binary_file(f)

line 1: The module is "message_from_binary_file", not "msg_from_binary_file"
line 4: The mode must be "rb", not "b".
line 5: Same module (mis-)name problem as line 1.

Then in following example...

  >>> import os
  >>> with open('converted.txt', 'wb') as f:
  ...   f.write(msg.as_string (policy=msg.policy.clone (linesep=os.linesep))

line 3: Ubnbalanced parens, .as_string() has no "policy" keyword arg.

Please note I am trying to figure out how to use the email module for the first time and the above errors are glaring.  There may be (probably are) other errors in the examples and in the text that I am unaware of -- I've made  no attempt to find any others.  I suggest that someone familiar with email module review this page more carefully.
History
Date User Action Args
2013-07-29 06:27:08rurpy2setrecipients: + rurpy2, docs@python
2013-07-29 06:27:08rurpy2setmessageid: <1375079228.82.0.247789886969.issue18584@psf.upfronthosting.co.za>
2013-07-29 06:27:08rurpy2linkissue18584 messages
2013-07-29 06:27:08rurpy2create