Building python scripts

Someone once commented on the  Camera Mixer’s scriptspot page, that the tool sounded interesting, but unless an installer is provided he wouldn’t even try to use it.

Indeed : you have to install python, then pywin32 and wxPython, and just trying to find the correct compatible versions on the web is a hassle.

So I decided to have a look on py2exe and other tools to “build” python scripts.

This post will deal with all my researches, and will be often updated.

It doesn’t intend to be a tutorial at all.

  1. Start point
  2. msvcr90, msvcp90
  3. the r6034 error and the manifest

Start point

Good urls to start with :

In the simple sample provided with py2exe, the test_wx.py is using the obsolete writing of wxPython.
The one in the singlefile sample is good though.

The magic words are :

python.exe setup.py py2exe

The DLL msvcp90 and msvcr90

Those files are required when you want to create a build of a tool using wxPython.

There’s a question of rights to share those files. I frankly don’t know  if I have them  (actually I doubt it) , the solution is to make the user download them via vcredist_x86.exe .

Apparently, you should not download the SP1 version. I don’t really know why.

 The R6034 error

http://stackoverflow.com/questions/1153643/how-do-i-debug-a-py2exe-application-failed-to-initialize-properly-error

msvcr90.dll Manifest (publicKeyToken, version)

Edit the manifest part in setup.py and put the correct values (given in Microsoft.VC90.CRT.manifest)

MemoryLoadLibrary

ImportError: MemoryLoadLibrary failed loading win32api.pyd

http://stackoverflow.com/questions/1979486/py2exe-win32api-pyc-importerror-dll-load-failed

So the setup.py should look like :

setup(
     options = {"py2exe": {"compressed": 1,
                 "optimize": 2,
                 "ascii": 1,
                 "bundle_files": 1,
                 "dll_excludes": [ "mswsock.dll", "powrprof.dll" ]}},
     zipfile = None,
     windows = [CameraMixer]
)

Still questions

In setup.py, what does RT_MANIFEST = 24 mean ?

Leave a Comment

*