Running multiprocessing Python code in Wine

If you try to use the multiprocessing module in Python 2.6 in a Wine environment, you'll hit a bug. You'll have to patch the Lib\multiprocessing\connection.py file, wrap the call to win32.SetNamedPipeHandleState in the Pipe function in an exception handler block and silently catch WindowsError exceptions where the return value is zero (these are not errors, but an exception is thrown nontheless).

PS: I hit this when I tried to run multi-mechanize on Ubuntu using Wine 1.2.x (don't even bother trying with Wine 1.0.x, it won't work). And I did this, because a load testing scenario I was working on was meant to be used on Windows and I wanted to see if it works in Wine too. Smile