David Bear wrote: > I'm confused about how to use the email module in python 2.4.x > > I'm using python packaged with suse 9.3. > >>From the module documetation at http://docs.python.org/lib/node597.html I > found the following example (items cut): > > import email > > ... > msg = email.message_from_file(fp) > .. > > Yet, when I try this I get the message > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > AttributeError: 'module' object has no attribute 'message_from_file' > > so I dir(email) reveals: > > ['__builtins__', '__doc__', '__file__', '__name__', 'cStringIO', 'email', > 'getMessage', 'sys'] > > This is nothing like the documentation on python.org. > > Any idea what I am missing?
That's not what I have on OS X with Python 2.4.1. In [1]: import email In [2]: dir(email) Out[2]: ['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '__version__', 'message_from_file', 'message_from_string'] Are you sure that you're getting the right file? Check email.__file__ . -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list