ktm5124 ktm5124 - 1 year ago 398
Python Question

ImportError: No module named mime.multipart

Good morning,

For testing purposes, I have made a one-line Python program:

from email.mime.multipart import MIMEMultipart

When I run it through the interpeter, I get an awful error message:

from email.mime.multipart import MIMEMultipart
ImportError: No module named mime.multipart

I am using Python version 2.4.3. I suspect that the email module has changed its packaging structure in the intervening versions, hence the error. Is my suspicion correct? If not, why is the import statement not working?

Thanks in advance,


Answer Source

Module reorganization. The convention is for module names to be lower case, so some got renamed. In this case, the module you're looking for in Python 2.4.3 is email.MIMEMultipart.

Here's the docs from back then, in case the API has changed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download