Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe executables?

Waldemar Osuch waldemar.osuch at gmail.com
Thu Dec 31 15:33:40 EST 2009


On Dec 30, 10:05 am, kakarukeys <kakaruk... at gmail.com> wrote:
> I tried on a fresh XP on VM. I moved all dlls in C:\WINDOWS\WinSxS
> which are in the file handles shown by Process Explorer including the
> 3 CRT dlls to the my dist folder and the two subfolders suggested byhttp://wiki.wxpython.org/py2exe. It didn't work out. My app couldn't
> start. Windows XP gave a cryptic error asking me to reinstall the app.
>
> After installing vcredist_x86.exe, my app starts fine. There isn't a
> choice here. You HAVE TO bundle vcredist_x86.exe with your installer
> and convince your customers that it is necessary to increase the file
> size by 2MB.
>
> If anyone figure out how to do ashttp://wiki.wxpython.org/py2exe, or
> on a Python compiled with a free GNU compiler, avoiding all these BS.
> I will pay him/her $10.

I have a method that does not involve installing the runtime and still
works on a "virgin" machine.

The target machines are locked desktops and installing anything
on them equals to a 2 month long approval process.
"The Preventer of IT" strikes again :)

But anyway,  the method involves editing python26.dll in order to
remove
dependency references and then dropping msvcr90.dll in the same
directory as the py2exe produced executable. Here is dir /b:

lib/
msvcr90.dll
python26.dll  <-- tweaked
UI.exe

The method works with a program using wxPython.

I have used Resource Hacker http://www.angusj.com/resourcehacker/
for actual editing.
You have to find <dependency> section of the manifest and remove
everything between <dependentAssembly> tags

Before:
<dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT"
version="9.0.21022.8" processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>

After:
<dependency>
    <dependentAssembly>
    </dependentAssembly>
  </dependency>

Is the method elegant?  Nope.
Does it work?  It does for me.
Use it at your own risk etc. The regular disclaimers apply.

The approach was gleaned from a thread at PIL mailing list.
http://mail.python.org/pipermail/image-sig/2009-October/005916.html

waldemar



More information about the Python-list mailing list