Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#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


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
+    from email.utils import parseaddr
+except ImportError:  # python 2.4
+    from email.Utils import parseaddr

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by Ryan J Ollos

Resolution: duplicate
Status: newclosed

Now that I've caught up on recent activity, I see this is a duplicate of #11428 and #9106.

Last edited 4 years ago by Ryan J Ollos (previous) (diff)

comment:2 Changed 4 years ago by Jun Omae

Python 2.5 to 2.7 keep backwards compatibility for package naming of email library, see

$ 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>

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Steffen Hoffmann.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.