can't send email

Chris Rebert chris at rebertia.com
Tue Sep 7 16:27:43 EDT 2010


On Tue, Sep 7, 2010 at 1:12 PM, Bob <roberto.pagliari at gmail.com> wrote:
> Hello.
> I'm trying to send email using python 2.6.1 under snow leopard, but I
> can't get it to work. I'm trying one of the many examples I found on
> the web
<snip>
> The error I get is this
>
> python email.py
> Traceback (most recent call last):
>  File "email.py", line 2, in <module>
>    import smtplib
>  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/smtplib.py", line 46, in <module>
>    import email.utils
>  File "/Users/Bob/Code/email.py", line 5, in <module>
>    from email.mime.text import MIMEText
> ImportError: No module named mime.text
>
>
> I'm using the native python version installed by apple, so I don't
> know why email and email.utils and mime are not found. I checked on
> the filesystem and they are present...

Your /Users/Bob/Code/email.py file is shadowing the std lib "email"
module. Rename your file to something else so that it no longer
conflicts.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list