[python-win32] py2exe bug with email.MIMEText

Werner F. Bruhin werner.bruhin at free.fr
Fri Aug 1 13:57:39 CEST 2008


Hi Marcus,

Marcus.CM wrote:
> There is a bug with py2exe when (at least under windows) when importing 
> email
> 
> # example testmime.py
> import email
> msg = email.MIMEText.MIMEText("dsafdafdasfA")
> print "ok"
> 
> 1. Save the text above and setup as testmime.py
> 2. Run it and u can see "ok"
> 3. Create setup.py and run :  python setup.py py2exe
> 4. Run the testmime.exe and u will get error "Import error : No module 
> name text"
> 
> # Example setup.py
> from distutils.core import setup
> import py2exe
> setup(console=['testmime.py'])
> 
> Anyone knows the fix for this?
I see that you did find a solution for your problem.

An alternative solution is to force py2exe to include all of the email 
package.

     packages = ['matplotlib.numerix',
                 'pytz.zoneinfo.UTC',
                 'email',
                 'encodings',
		... etc]

Werner



More information about the python-win32 mailing list