Wednesday, August 26, 2009

Python 2.6, py2exe, and VC++ Runtime Issues

I got this annoying error the other day, while freezing a python 2.6 executable on Windows:

py2exe msvcp90.dll no such file or directory

Background:

Python 2.6 uses Visual Studio 2008, and so it requires the Visual Studio 2008 C++ Runtime (vcredist).

I saw a few posts on the web, here and here. They get the solution partially right.

The Correct way to fix py2exe msvcp90.dll no such file or directory.

In your setup.py file first exclude the dll so you can build the exe.

options = {
"py2exe": {
"compressed": 1,
"optimize": 2,
"bundle_files": 2,
"dll_excludes": [
"MSVCP90.dll",
]
}}


Then add this to your manifest file in between the tags:

<dependency>
<dependentassembly>
<assemblyidentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorarchitecture="x86" publickeytoken="1fc8b3b9a1e18e3b"></assemblyidentity>
</dependentassembly>
</dependency>

This allows you to use the vcredist to install the required vc++ dlls on the target system.

Monday, August 24, 2009

Annoing Windows XP issue : _except_handler4_common could not be located

Thanks to Dev Adventures for this one.

I had one of the most annoining Windows XP issue. It happened while building a py2exe project on Windows Vista, and installing it on Windows XP.

The issue, a most cryptic error message:

"The procedure entry point _except_handler4_common could not be located in the dynamic link library msvcrt.dll"

The solution:

Remove the mswsock.dll from the distribution.


Wednesday, August 05, 2009

Visual Studio 2008 UAC Issue

Thanks Jim!

Visual Studio 2008 UAC Problem

I had a Visual Studio 2005 project with a manifest that set requireAdministrator. When ported to Visual Studoi 2008 I got this error: manifest authoring error c1010001: Values of attribute "level" not equal in different manifest snippets.

Solution

Remove the explicit manifest file and set the UAC.

1. Remove the explicit manifest file "Configuration Properties > Manifest Tool > Input and Output" remove the "Additional Manifest Files" value

2 Go to "Configuration Properties > Linker > Manifest File" and change the UAC Execution Level