[docs] [issue18584] examples in email.policy doc are fu'd
report at bugs.python.org
Mon Jul 29 08:27:08 CEST 2013
New submission from rurpy:
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.
assignee: docs at python
nosy: docs at python, rurpy2
title: examples in email.policy doc are fu'd
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the docs