Skip to content Skip to sidebar Skip to footer

Import Error When Building Python Using Py2exe

I am trying to make a small script to remotely manage windows computers (currently only shutdown). The method I am using involves a webapp2 server. i would like to compile my first

Solution 1:

I have discovered that the problem was that I was presuming that py2exe would import webob as the interpreter does. In fact I needed to put the webob folder in the folder that I was building in.

Solution 2:

I am not sure, but you could try specifically including email.utils in the setup.py by adding the following argument to the setup function call in the script that imports py2exe:

options={"py2exe": {'includes': ["email.utils"]}}

That, or you could try specificly importing it before you import webapp2, like on line 1:

import email.utils
import cgi
import webapp2

If this says it can't find a diferent module, try adding the module in the includes list:

options={"py2exe": {'includes': ["email.utils", "othermodulename"]}}

or specificly importing it again. Hope this helps! :-)

Post a Comment for "Import Error When Building Python Using Py2exe"