We have a GUI-based application written basically in C. The
application allows the user to embed Python scripts, e.g. for
scripting some functionality of the application.
Some of our users are interested in running multiprocessing Python
code. We have found that this does not work, bringing up various types
of errors, depending on how the script invokes multiprocessing.
I have tried to isolate the issue, and found that the following simple
const char* script =
"from multiprocessing import Process\n"
"import os, time\n"
"def sleeper(name, seconds):\n"
"p = Process(target=sleeper, args=('bob', 1))\n"
"print 'starting child process'\n"
with the following output:
starting child process
Traceback (most recent call last):
File "<string>", line 9, in <module>
python2.6/multiprocessing/process.py", line 119, in join
res = self._popen.wait(timeout)
python2.6/multiprocessing/forking.py", line 117, in wait
python2.6/multiprocessing/forking.py", line 106, in poll
pid, sts = os.waitpid(self.pid, flag)
OSError: [Errno 4] Interrupted system call
The same Python script, when saved as a .py file and invoked from the
console, works fine.
System information: MacOS 10.5.6, Pyton 2.6.2.
Thanks for any advice in advance.