1

I have a script in python that send an email

import email
import email.mime.application
...
msg = email.mime.Multipart.MIMEMultipart()
    msg['Subject'] = 'test'
    msg['From'] = 'test@gmail.com'
    msg['To'] = 'test@gmail.com'
body = email.mime.Text.MIMEText("""test""")

....

In python the script is running well, but after I compile it with py2exe I get this error

Traceback (most recent call last):
  File "mail.py", line 13, in <module>
  File "email\__init__.pyc", line 79, in __getattr__
ImportError: No module named multipart

In the py2exe compilation log I see this message

...
The following modules appear to be missing
['_scproxy', 'email.MIMEBase', 'email.MIMEMultipart', 'email.MIMEText']
....

Any idea how to fix this ? Thanks

Roco20099
  • 33
  • 3

1 Answers1

1

If in python the script runs well, it seems that py2exe is not including all the needed modules.

Take a look at this question Python - Py2exe can't build .exe using the 'email' module

Community
  • 1
  • 1
Gianluca
  • 3,227
  • 2
  • 34
  • 35