Bug in win32all-128 with multiprocessor NT

krodgers at tdyryan.com krodgers at tdyryan.com
Thu Feb 24 16:27:21 EST 2000


Here's a bug I've run across in win32all-128 (actually, has been present
at least since win32all-125, but I've been too busy to report it) on a
two-processor NT box.  I've reproduced the bug on several different
machines, with NT 4 SP3, SP4, SP5.  Here's the problem: For
reasons too obscure to go into here, I have an app that I need to
make sure is only running on one processor of a dual-processor
machine.  For processname "pname", here's a script to do that:

import win32api, win32pdhutil, win32con, win32process
pid = win32pdhutil.FindPerformanceAttributesByName("pname")
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, 0, pid[0])
win32process.SetProcessAffinityMask(handle, 1)
win32api.CloseHandle(handle)

Using win32all-125, -127, or -128, this script dies with the following
error:
'The instruction at "0x00000001" referenced memory at "0x00000001". The
memory could not be "read".'

If you run the script in Pythonwin, then Pythonwin is the process in
which the error is reported; if you run the script with just the plain
Python interpreter, the error is reported in python.exe.

The process affinity actually does get set correctly, so the error is
more an annoyance than anything, but since I noticed that the
SetProcessAffinityMask function is mentioned in the new Win32 Python
book, I thought I'd report this problem.  If anybody else has a
multiprocessor machine they could try this out on, I'd be very
interested to hear the results.  You can email me at
krodgers at ryanaero.com.  Thanks!

Kevin Rodgers
Northrop Grumman Ryan Aeronautical Center
krodgers at ryanaero.com
"Snakes.  Why did it have to be snakes?" -- Indiana Jones


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list