| | |
Import error with py2exe
Thread Solved |
Hi guys,
I was making a program yesterday that would send an email using the email modules of python as well as the smtp module.
My problem is when i put it into an exe using py2exe and vega's code snippet setup i get some problems. This is the error message i get when i try and run the .exe file:
The thing is that is works fine when i run it when it is not compiled into an exe. Im not that crash hot with py2exe so i was wondering is someone with a bit more idea with me could point me in the right direction. Here is my code for any reference.
Cheers!
I was making a program yesterday that would send an email using the email modules of python as well as the smtp module.
My problem is when i put it into an exe using py2exe and vega's code snippet setup i get some problems. This is the error message i get when i try and run the .exe file:
•
•
•
•
Traceback (most recent call last):
File "email_program.py", line 2, in <module>
File "email\__init__.pyc", line 79, in __getattr__
ImportError: No module named multipart
python Syntax (Toggle Plain Text)
import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email import Encoders import pythoncom, pyHook import os global s s = "" gmail_user = "*************" gmail_pwd = "************" def mail(to, subject, text): msg = MIMEMultipart() msg['From'] = gmail_user msg['To'] = to msg['Subject'] = subject msg.attach(MIMEText(text)) mailServer = smtplib.SMTP("smtp.gmail.com", 587) mailServer.ehlo() mailServer.starttls() mailServer.ehlo() mailServer.login(gmail_user, gmail_pwd) mailServer.sendmail(gmail_user, to, msg.as_string()) # Should be mailServer.quit(), but that crashes... mailServer.close() mail('paulthom12345@gmail.com', 'subject', 'Hello from python')
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Yeah, the problem seems to be that the email module is not being packed with the .exe file and i couldn't find a way to get it to be. Does anyone know how i can package all of the stuff i import?
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
This is a common problem, it seems you have to manually include the mail module, this link maybe of help to you
http://stackoverflow.com/questions/1...am-with-py2exe
Also another suggestion rather than py2exe use bbfreeze
http://pypi.python.org/pypi/bbfreeze/0.95.4
Chris
http://stackoverflow.com/questions/1...am-with-py2exe
Also another suggestion rather than py2exe use bbfreeze
http://pypi.python.org/pypi/bbfreeze/0.95.4
Chris
Knowledge is power -- But experience is everything
Chris the first one worked a charm. Thanks!
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
![]() |
Similar Threads
- Compiling SPE IDE Using PY2EXE (Python)
- Module not found when running in command prompt (Python)
- Running a program from within a py script... (Python)
- syntax errors and the check module command? (Python)
Other Threads in the Python Forum
- Previous Thread: Mario clone
- Next Thread: ImportError: no module named main?
| Thread Tools | Search this Thread |
abrupt ansi anti apache approximation array assignment avogadro backend beginner binary book builtin calculator character code converter countpasswordentry curved customdialog dan08 dictionaries dictionary dynamic examples exe file float format function gnu graphics gui heads homework import inches input java launcher library line lines linux list lists loop mouse mysql mysqlquery number numbers numeric output parsing path phonebook plugin pointer port prime programming progressbar projects py2exe pygame pysimplewizard python random recursion redirect scrolledtext software statictext statistics string strings sum table terminal text textarea thread threading time tlapse trick tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable wordgame write wxpython xlib






