[issue2622] Import errors in email.message.py

Zach Hirsch report at bugs.python.org
Wed May 13 04:35:40 CEST 2009


Zach Hirsch <zhirsch at umich.edu> added the comment:

I'm not sure if this is the same problem, but it seems related.  I can
get the same ImportError without involving py2exe or modulefinder:

Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import email.message
>>> sys.modules = sys.modules.copy()
>>> msg = email.message.Message()
>>> msg['From'] = 'foo at bar.com'
>>> msg.as_string()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/email/message.py", line 128, in as_string
    from email.Generator import Generator
  File "/usr/lib/python2.5/email/__init__.py", line 80, in __getattr__
    mod = sys.modules[self.__name__]
KeyError: 'email.generator'

If the "sys.modules = sys.modules.copy()" line is left out, everything
works as expected.

----------
nosy: +zhirsch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2622>
_______________________________________


More information about the Python-bugs-list mailing list