email.utils does not exist in Python 2.4
|Reported by:||rjollos||Owned by:||hasienda|
This issue was raised in SO:20284917.
In , 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