[python-win32] terminateprocess, getprocessid and compiling trunk on win32

benjamin deboute deboute at gmail.com
Thu May 10 18:34:53 CEST 2007


Hi Pythonistas,

i'm currently building a multi-platform renderfarm application, and
would need to use GetProcessId to circumvant problems i encounter when
i try to kill processes on win32

IE: i can't kill with TerminateProcess a process i spawned with
CreateProcess (getting a Acess Denied error), but i can kill it using
this chunk of aspn'd code

PROCESS_TERMINATE = 1
handle = win32api.OpenProcess(PROCESS_TERMINATE, False, pid)
win32api.TerminateProcess(handle, -1)
win32api.CloseHandle(handle)

As i haven't found any way to get the pid except searching for the
process name (but as we'll get several instances of maya.exe running
on a renderslave, it won't get me far), i browsed the cvs source and
found a function that was recently added: GetProcessId

I then tried to compile the cvs trunk using python setup.py build, but
got this error

Building pywin32 2.4.210.1
running build
running build_py
running build_ext
Warning - can't find an installed platform SDK
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

After several .net installs, i still got this error : \
i also tried (and failed) compiling it on visual studio, cygwin+mingw,
but as i'm quite the noob on the subject of compiling for windows, i'm
afraid i'm quite lost at the moment (my skills are limited to loading
the project, clicking on build and watching the build fail with
wide-eyed horror)
Has someone got any pointers on compiling the cvs trunk ? A link to a
quick howto or just a small paste of working compiling commands would
be very appreciated

Alternatively, if anyone knew how to effectively kill a process
without the 'access denied' error (excepting running the service as
administrator), i'll be very happy with it


have a nice day and thanks in advance,
ben


More information about the Python-win32 mailing list