Reza Lotun wrote:
I'd like to run a python function in a new process, like python 2.6's multiprocessing does. I wanted to use ProcessProtocol, but it seems to only work for executing executables and interacting with them using stdin/stdout/other fds. Is there a way of running a python piece of code in a new process?
Well, the only way to run Python code is to run the Python interpreter in a process and feed it the python code you want to run (using the -c option).
Hi Reza, yes, I'd thought of that, but I can't get the function's code, I tried the inspect module but it only works of the code is written to disk; I'd rather not have to first write the code to disk just to be able to turn it into a string and feed it to python -c. Any ideas on how I could do this? Thanks, Gabriel