On 2019-12-08 19:13, b...@bbhoyer.com wrote:
Just registered
Thanks
-------- Original Message --------
Subject: ModuleNotFoundError: No module named 'email.mime'; 'email' is
not a package
From: <[1]b...@bbhoyer.com>
Date: Sun, December 08, 2019 11:14 am
To: [2]python-list@python.org
Hello Python Team,
I am a beginner in Python, been working on class material from Mosh
youtube 6 hrs., Mosh 12 hr paid course; Python Cash Course by Eric
Matthes … most of the time everything works just fine or a little
adjustment for updated versions.
I am running Python 3.8.0
In example, Mosh 12 hr course, he did an exercise on sending email from
within Python, so here is the code :
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
message = MIMEMultipart()
message["from"] = "Bob Hoyer = Python"
message["to"] = "[3]b...@bbhoyer.com"
message["subject"] = "This is a test using Python"
message.attach(MIMEText("Body"))
# godaddy recommended SMTP_SSL, host name & port #
with smtplib.SMTP(host="smtpout.secureserver.net", port=465) as smtp:
smtp.ehlo()
# godaddy recommended removing ...
# smtp.starttls()
smtp.login("[4]em...@email.com", "password") #email login &
password blanked out for this msg
smtp.send_message(message)
print("Sent ...")
smtp.close()
Here is the error message:
Traceback (most recent call last):
File "c:\Users\Owner\Desktop\HelloWorld\[5]email.py", line 1, in
<module>
from email.mime.multipart import MIMEMultipart
File "c:\Users\Owner\Desktop\HelloWorld\[6]email.py", line 1, in
<module>
from email.mime.multipart import MIMEMultipart
ModuleNotFoundError: No module named 'email.mime'; 'email' is not a
package
I have spent some time trying to figure out resolve ...
Can you help me with this pistol of a problem …
Bob Hoyer
[snip]
I notice you have files called "[5]email.py" and "[6]email.py". Do you
also have one called "email.py"?
If so, then what's happening is that Python is finding that one before
the one in the stdlib.
--
https://mail.python.org/mailman/listinfo/python-list