Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Server cannot execute a py2exe-generated app

A simple python script needs to run on a windows server with no python installed.

I used py2exe, which generated a healthy dist subdirectory, with script.exe that runs fine on the local machine.
However, when I run it on the server (Windows Server 2003 R2), it produces this:
The system cannot execute the specified program.

and ERRORLEVEL is 9020.

Any ideas?

like image 741
Paul Oyster Avatar asked Dec 24 '09 21:12

Paul Oyster


1 Answers

For py2exe to work, you have to include the correct version of the Microsoft C runtime DLL with your application.

For Python2.6, this is MSVCR90.dll version 9.0.21022.8, which can be obtained from the Microsoft Visual C++ 2008 Redistributable Package:

http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en

NOTE that the SP1 of this installer contains a different version of the DLL, and will not work.

I spent a while earlier this year explaining this carefully in the py2exe tutorial, so I'll just link to that: http://www.py2exe.org/index.cgi/Tutorial#Step5

like image 122
Jonathan Hartley Avatar answered Sep 19 '22 22:09

Jonathan Hartley