ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package

DL Neil PythonList at DancesWithMice.info
Sun Dec 8 17:34:31 EST 2019


On 9/12/19 8:13 AM, bob at bbhoyer.com wrote:
>     Just registered
>     Thanks

Hi @bob, welcome to the gang...


>       I am a beginner in Python, been working on class material from Mosh
...

>       from email.mime.multipart import MIMEMultipart
...

>       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 …


("pistol"? ...he says, manfully-struggling with the temptation to 
suggest that you "make love not war"...)


Let's look at the information given (in the "stack trace":

<<<ModuleNotFoundError: No module named 'email.mime'; 'email' is not a 
package>>>

On line 1, the code requests that a module named/addressed as 
"email.mime.multipart" be located ("found"), and an object 
("MIMEMultipart") be imported (etc, etc).

So, when executing line 1, Python was unable to find the specified 
module (let's over-simplify and use the word: "file").


Libraries from the Python Standard Library are not included in the basic 
"python" download, and have to be added/separately downloaded, when 
needed. I suspect this is the problem (but may not be)!


Sadly, I am not a user of MS-Win, so am loath to try to help much more, 
for fear of leading you along the wrong track.  Herewith some self-study 
which should put your boots (back) on the ground...


WebRefs: installing packages
This is more readable: 
https://protechguides.com/how-to-install-python-library/
This is from 'the book of words': 
https://packaging.python.org/tutorials/installing-packages/

NB I understand that "pip" is installed on MS-Win as part of python, so 
you don't need to worry about that/can quickly check. If your course has 
not taken you through "virtual environments" then feel free to ignore 
such, for now.
-- 
Regards =dn


More information about the Python-list mailing list