set_process_affinity_mask problem - Python 2.5 gcc 4.3.2 (Ubuntu 4.3.2-1ubuntu12)

Isaac Gouy igouy2 at
Mon Mar 9 03:42:37 CET 2009

For a couple of months, I've been successfully using the Python set_process_affinity_mask wrapper from

Now I've upgraded from Ubuntu 8.04 to Ubuntu 8.10 (from gcc 4.2.3 to gcc 4.3.2) and set_process_affinity_mask seems to fail on the x86 Ubuntu install.
It still works fine, after upgrade, on the x64 Ubuntu install.

I've tried re-installing Python, and the affinity package, and gcc, and glibc, and ... without getting it to work.

Specifically, I have a function

         def setAffinity():
            if affinitymask:

which is passed to a spawned process

p = Popen(commandline,...,preexec_fn=setAffinity)

Reducing setAffinity() to os.getpid() lets the program run without failure, trying to get_process_affinity_mask or set_process_affinity_mask gives

ERROR 22 Invalid argument

Please suggest what I can do to debug / fix this problem.


More information about the Python-list mailing list