If you want to run a shell command, a subprocess is the way to go. Because it can run a shell command in its own process, using multiprocessing is redundant at best. Multiprocessing comes in handy when you want to run the function of your python program in a separate process. It seems you are going to run a shell command, not a python function.
I am not familiar with curl . If you want to get standard output from curl , use subprocess.Popen() . subprocess.call() returns the program return code, not stdout .
See http://docs.python.org/release/3.2/library/subprocess.html
Sort of:
subp = subprocess.Popen(['curl', '-O', imgurl], stdout=subprocess.PIPE, stderr=subprocess.PIPE) curlstdout, curlstderr = subp.communicate() op = str(curlstdout)
maybe closer. Not familiar with curl , as I said, so your program may be different.
source share