473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

email module documentation

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?

--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
Nov 23 '05 #1
2 2241
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
ro*********@gmail.com

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Nov 23 '05 #2
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 --
Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stuart D. Gathman | last post by:
I am trying to convert an application using rfc822, mimetools and multifile to use the new email package. In addition to the param parsing anomoly noted earlier, here is a test message that the...
1
by: Adrien Di Mascio | last post by:
Hi all, While reading the email module documentation, I found an error in a small example given for the as_string() method of the Message class: Here is the given code : (URL :...
1
by: Chuck Amadi | last post by:
A little help has anyone used the email-dir.py Email Module ,I have downloaded the example and would like some pointers to get it going . For example Have I got to add any parameters to python...
1
by: Arenz, Ralph | last post by:
hi all, my problem is to get a tiff-file-attachment out of an email sent by a fax-server. When i try this with "get_payload(decode='True')" i get additional informations, looks like...
6
by: Tony Burrows | last post by:
Just getting to grips with Python, a great language BUT With something like Java I can find the syntax of a method call with no problems, how do I do the same with Python? For example, using...
3
by: Erik Johnson | last post by:
THE GOAL: I need to send an email with a simple ASCII text body and an attached HTML file. I have scripts that send basic emails via the smtplib module that don't have any attachements and that...
0
by: rb.online | last post by:
Hi all, I rencently had trouble finding a bug in an email processing script because of an error that pass silently in the email module. The get_payload() method in the email.message module...
0
by: Nico Grubert | last post by:
Hi there, I wrote a short python script that sends an email using python's email module and I am using Python 2.3.5. The problem is, that umlauts are not displayed properly in some email...
2
by: Lev Elbert | last post by:
Hi, all! I have to make a custom email module, based on the standard one. The custom module has to be able to work with extremely large mails (1GB +), having memory "footprint" much smaller....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.