Question

I have a Python 2.7.2 program with wxPython 2.8.12 and comtypes 0.6.2 dependencies on a win XP SP3 machine. I am using py2exe to produce windows distributables with the following setup:

setup(
    options = {
        "py2exe": {
                   "packages": ['wx.lib.pubsub']
                  }
    },
   windows = [
       {
           "script" : "entry.py",
       }
   ],
   data_files=[("bitmaps", ["../resources/icons/app_big.png",
                            "../resources/icons/app_medium.png",
                            "../resources/icons/app_small.png",
                            "../resources/icons/app_small_new.png",
                            "../resources/icons/app_small_bad.png",
                            "../resources/icons/cross_hover.png",
                            "../resources/icons/cross.png",
                            "../resources/icons/delete.png",
                            "../resources/icons/refresh.png",])]
)

I am also using the IEHtmlWindow control.

What is happening is that whenever I issue the command at the Python console, py2exe runs for a second with the following output:

running py2exe * searching for required modules *

and then appears to hang indefinitely until I press Ctr+z.

I have tracked down the problem to the import :

from wx.lib.iewin import IEHtmlWindow

which seems to be causing the problem.

Any suggestions?

Was it helpful?

Solution

Solved, the problem was that comtypes generated a very large module file which was taking too much time to parse by py2exe:

comtypes.gen._3050F1C5_98B5_11CF_BB82_00AA00BDCE0B_0_4_0

The workaround is to patch py2exe source code (ver 0.6.9) as pointed out by Erez Bibi in his post:

http://groups.google.com/group/wxPython-users/browse_thread/thread/52deb8a0bc1cdc5e

and now with the setup file

options={
             "py2exe": {
                        'packages': ['wx.lib.pubsub'],
                        'includes': ['comtypes.gen._3050F1C5_98B5_11CF_BB82_00AA00BDCE0B_0_4_0'],
                        'skip_scan': ['comtypes.gen._3050F1C5_98B5_11CF_BB82_00AA00BDCE0B_0_4_0']
                        }
             },

everything seems to be working great once again.

OTHER TIPS

There are actually two versions of IEHtmlWindow. You can try importing the other one:

from wx.lib.iewin_old import IEHtmlWindow

And see if that works. If it does, awesome. If not, then you should probably go cross-post to the py2exe mailing list and/or the wxPython mailing list.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top