Modify ↓
#11432 closed defect (duplicate)
email.utils does not exist in Python 2.4
Reported by: | Ryan J Ollos | Owned by: | Steffen Hoffmann |
---|---|---|---|
Priority: | normal | Component: | AnnouncerPlugin |
Severity: | normal | Keywords: | |
Cc: | Jun Omae | Trac Release: | 0.12 |
Description
This issue was raised in SO:20284917.
In [8081], the email.utils
package was imported.
$ python2.5 Python 2.5.6 (r256:88840, Oct 28 2013, 23:50:06) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import email.utils >>> user@ubuntu:~/Workspace/bhdev$ python2.4 Python 2.4.6 (#2, Oct 28 2013, 20:07:19) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import email.utils Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named utils
It appears that email.Utils
existed in Python 2.4 and was renamed to email.utils
in Python 2.5. Unfortunately this doesn't seem to have been captured in the Python documentation. Here is another ticket where they came to the same conclusion.
May I push the following change?
-from email.utils import parseaddr +try + from email.utils import parseaddr +except ImportError: # python 2.4 + from email.Utils import parseaddr
Attachments (0)
Change History (2)
comment:1 Changed 11 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
Python 2.5 to 2.7 keep backwards compatibility for package naming of email
library, see http://hg.python.org/cpython/file/ae9fb85ab4e0/Lib/email/__init__.py#l87.
$ for i in 2.{4,5,6,7}; do python$i -c 'from email.Utils import parseaddr; import sys; print "%r\n%r" % (sys.version_info, parseaddr)'; done (2, 4, 3, 'final', 0) <function parseaddr at 0xb7f233e4> (2, 5, 6, 'final', 0) <function parseaddr at 0x96a417c> (2, 6, 8, 'final', 0) <function parseaddr at 0xb7cb872c> sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0) <function parseaddr at 0x9d76cdc>
Note: See
TracTickets for help on using
tickets.
Now that I've caught up on recent activity, I see this is a duplicate of #11428 and #9106.