Parallel Python Community Forums

Python Forums => Parallel Python Forum => Topic started by: afaulconbridge on August 22, 2011, 04:28:33 AM



Title: subprocess
Post by: afaulconbridge on August 22, 2011, 04:28:33 AM
I am trying to use the subprocess module in the standard library without luck For example:

import pp

def myfunc():
    subprocess.call("hostname")

if __name__ == "__main__":

    job_server = pp.Server()
    j = job_server.submit(myfunc, modules=("subprocess",))
    j()


This gives the error:

Exception in thread run_local:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.6/threading.py", line 477, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.6/dist-packages/pp.py", line 721, in _run_local
    job.finalize(sresult)
UnboundLocalError: local variable 'sresult' referenced before assignment

I know that the error in PP will be fixed in the next version (http://www.parallelpython.com/component/option,com_smf/Itemid,29/topic,604.0), but it also seems like PP clients cant spawn new processes. I guess this may also affect multiprocessing and threading modules as well.