[Tutor] Sending an email alert

Kent Johnson kent37 at tds.net
Sat Aug 29 01:36:23 CEST 2009


On Fri, Aug 28, 2009 at 3:00 PM, Marc<marc at marcd.org> wrote:
> Hello,
>
>
>
> I am trying to code an email alert and am running into the following error:
>
> Connecting to server
>
> Traceback (most recent call last):
>
>   File "C:\Users\Marc1\Documents\Python\email test\email.py", line 1, in
> <module>
>
>     import smtplib
>
>   File "C:\Python26\lib\smtplib.py", line 46, in <module>
>
>     import email.utils
>
>   File "C:\Users\Marc1\Documents\Python\email test\email.py", line 12, in
> <module>
>
>     s = smtplib.SMTP('smtp.marcd.org')
>
> AttributeError: 'module' object has no attribute 'SMTP'

Your file 'email.py' is hiding the std lib 'email' module and this is
creating a circular import and basically a mess :-)

Try calling your program something else.

Kent


More information about the Tutor mailing list