[python-win32] Building win32 extensions to Python

Chris Botos chris.botos at gmail.com
Thu Jun 15 01:45:03 CEST 2006


Hello List,

I've been using Python for a couple of months, primarily through 
wxPython, so I'm relatively new at the game, and to this list.  I have a 
need to interface a wxPython application to some C (and perhaps C++), 
functions (and classes) that return the results of various 
computations.  I am not a windows programmer - our app is targeted for 
Solaris, but we are creating some Windows demos, so I need to first get 
this working for win32.

For a few days now I've been surfing, searching python archives, other 
archives, online books, and trying but failing to build a sample 
extension for Python on Windows XP, SP2.  The documentation and 
discussions on this have been confusing to me (doing the same task on 
Unix looks more straightforward.).

The Python version that I have is:
"Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] 
on win32".

I've described what I've done up to now below.  I will continue hacking, 
but I am hoping one of the Python gurus will be able to steer me onto 
the right or better path (no pun intended)!

Thanks in advance for your advice!
Chris Botos

---------------------------------------------------------------

1)  I copied the example setup.py and elemlist.c from:
  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66509

2) ... and made modifications recommended at:
  http://www.vrplumber.com/programming/mstoolkit/index.html

It seems that a lot of recommendations I've read about are based 
somewhat on this site., but it is a few years out of date.

3)  I downloaded and installed:
.NET Framework SDK Version 1.1
Visual C++ 2005 Express Edition, that first installs .NET Framework 2.0
  (note that I could not get to a download for the 2003 version on 
Microsoft's site and the only other download site I found was at 
softpedia, and the download link there is broken )

4) I ran VC++ once to set up the environment.

5) Downloaded Windows Server 2003 R2 Platform SDK - this replaced the
version that the link in 2) pointed to.

6) At a regular command prompt, executed
  >python setup.py install
It could not find cl.exe.

7) After playing with the environment and getting a little farther, I 
found "Start --> ... --> Visual Studio 2005 Command Prompt"  that sets 
its own environment:

C:\Program Files\Microsoft Visual Studio 8\VC>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Chris Botos\Application Data
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=DIPLOID
ComSpec=C:\WINDOWS\system32\cmd.exe
DevEnvDir=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
FP_NO_HOST_CHECK=NO
FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0
FrameworkVersion=v2.0.50727
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Chris Botos
IBMSHARE=C:\IBMSHARE
INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;
LIB=C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program 
Files\Microsoft
Visual Studio 8\SDK\v2.0\lib;
LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
LOGONSERVER=\\DIPLOID
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program 
Files\Mic
rosoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 
8\Common7
\Tools;C:\Program Files\Microsoft Visual Studio 
8\SDK\v2.0\bin;C:\WINDOWS\Micros
oft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 
8\VC\VCPac
kages;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program 
Files\T
hinkPad\Utilities;C:\Program Files\ATI Technologies\ATI Control 
Panel;C:\Program
Files\PC-Doctor for Windows\;C:\Program Files\IBM ThinkVantage\Client 
Security
Solution;C:\Program Files\ThinkPad\ConnectUtilities;C:\Python24;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 8, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0d08
ProgramFiles=C:\Program Files
PROMPT=$P$G
RR=C:\Program Files\IBM ThinkVantage\Rescue and Recovery
SESSIONNAME=Console
SMA=C:\Program Files\IBM ThinkVantage\SMA\
SonicCentral=c:\Program Files\Common Files\Sonic Shared\Sonic Central\
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\CHRISB~1\LOCALS~1\Temp
TMP=C:\DOCUME~1\CHRISB~1\LOCALS~1\Temp
tvdumpflags=8
TVT=C:\Program Files\IBM ThinkVantage
TVTPYDIR=C:\Program Files\IBM ThinkVantage\Common\Python24
USERDOMAIN=DIPLOID
USERNAME=Chris Botos
USERPROFILE=C:\Documents and Settings\Chris Botos
VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8\VC
VS80COMNTOOLS=C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\
VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8
windir=C:\WINDOWS


8) I repeated    ">python setup.py install"   and got the following error:

c:\python24\include\pyconfig.h(130) : fatal error C1083: Cannot open 
include file: 'basetsd.h': No such file or directory
error: command '"C:\Program Files\Microsoft Visual Studio 
8\VC\BIN\cl.exe"' failed with exit status 2








More information about the Python-win32 mailing list