classification
Title: EmailMessage example doesn't work
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Srujan Chaitanya, barry, docs@python, ezio.melotti, flyjwayur, maciej.szulik, mdk, nharold, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2016-01-22 01:58 by Srujan Chaitanya, last changed 2016-07-10 18:02 by r.david.murray. This issue is now closed.

Files
File name Uploaded Description Edit
emailexample.patch nharold, 2016-05-31 18:50 fixes Address constructor usage review
Messages (8)
msg258781 - (view) Author: Srujan Chaitanya (Srujan Chaitanya) Date: 2016-01-22 01:58
Example provided in 19.1.14.1. Examples using the Provisional API
at https://docs.python.org/3.4/library/email-examples.html?highlight=email%20example

Doesn't work. This could be a EmailMessage class issue also?
msg261650 - (view) Author: HyeSoo Park (flyjwayur) * Date: 2016-03-12 13:42
Could you please specify which example of the Provisional API among 2 examples of the documentation and how does it not work? Thank you
msg261664 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2016-03-12 21:36
Is this your bug:

  Traceback (most recent call last):
    File "/tmp/email_example.py", line 9, in <module>
      with open(textfile) as fp:
  NameError: name 'textfile' is not defined

?

If not, can you please provide us the full traceback ?
msg261690 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2016-03-13 09:55
#26426 has been marked as duplicate of this, and contains more information about the error.
msg266768 - (view) Author: Nathan Harold (nharold) * Date: 2016-05-31 18:50
emailexample.patch fixes the specific issue mentioned in #26426: the Address constructor is now used as documented.  It changes the final output of the two combined examples (as presented in the documentation) accordingly.

In general it seems as though these examples (the two in in 19.1.14.1) were meant to be read, not run.  To run them, the user would have to supply (1) their own roasted-asparagus.jpg, (2) their own local SMTP server, and (3) their own implementation of imaginary.magic_html_parser.  However, the Address constructor usage issue was real, and I was able to generate the relevant output without (2) and (3).
msg266779 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-05-31 21:03
Thank you for the patch.  I blame the mistake on too great a familiarity with the old API :)
msg270114 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-07-10 18:01
New changeset 1530fd9a7089 by R David Murray in branch '3.5':
#26176: fix usage of Address constructor in email examples.
https://hg.python.org/cpython/rev/1530fd9a7089

New changeset a9c11fecd83b by R David Murray in branch 'default':
Merge: #26176: fix usage of Address constructor in email examples.
https://hg.python.org/cpython/rev/a9c11fecd83b
msg270115 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-07-10 18:02
Thanks, Nathan.
History
Date User Action Args
2016-07-10 18:02:35r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg270115

stage: commit review -> resolved
2016-07-10 18:01:12python-devsetnosy: + python-dev
messages: + msg270114
2016-05-31 21:04:09r.david.murraysetstage: needs patch -> commit review
2016-05-31 21:03:53r.david.murraysetnosy: + r.david.murray
messages: + msg266779
2016-05-31 18:50:00nharoldsetfiles: + emailexample.patch

nosy: + nharold
messages: + msg266768

keywords: + patch
2016-03-13 09:55:40ezio.melottisetversions: + Python 3.5, Python 3.6, - Python 3.4
nosy: + ezio.melotti

messages: + msg261690

stage: needs patch
2016-03-12 21:36:07mdksetnosy: + mdk
messages: + msg261664
2016-03-12 13:42:49flyjwayursetnosy: + flyjwayur
messages: + msg261650
2016-02-29 22:26:03maciej.szuliksetnosy: + maciej.szulik
2016-02-24 13:54:05barrysetnosy: + barry
2016-02-24 13:45:47berker.peksaglinkissue26426 superseder
2016-01-22 01:58:36Srujan Chaitanyacreate