email module documentation

David Bear david.bear at asu.edu
Tue Nov 22 23:44:19 EST 2005


Robert Kern wrote:

> 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__ .
> 

never mind. I just discovered my error. 
-- 
David Bear
-- let me buy your intellectual property, I want to own your thoughts --



More information about the Python-list mailing list