ktm5124 ktm5124 - 2 months ago 21
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,

ktm

Answer

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.

Comments