2012-02-22, 06:12
The following code:
...where 'exe' is a list containing the appropriate squeezeslave binary and arguments, works fine on Windows, Ubuntu, and Openelec.
It fails with
IOError: No Child Processes
...on OSX.
However, this code, later, works:
I am not an expert on (anything, including...) Python/Process Spawning - is there a better platform friendly way to do this (spawn a process and grad stdout from it)? I have found some odd stuff in Python in this area (e.g. os.system("chmod +X") works but os.chmod(file) does not!)
Code:
if constants.SYSTEM=="Windows":
output, result = subprocess.Popen(exe, creationflags=0x08000000, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell=False).communicate()
else:
output, result = subprocess.Popen(exe, shell=False, stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate()
...where 'exe' is a list containing the appropriate squeezeslave binary and arguments, works fine on Windows, Ubuntu, and Openelec.
It fails with
IOError: No Child Processes
...on OSX.
However, this code, later, works:
Code:
if constants.SYSTEM=="Windows":
slaveProcess = subprocess.Popen(exe, creationflags=0x08000000, shell=False)
else:
slaveProcess = subprocess.Popen(exe, shell=False)
I am not an expert on (anything, including...) Python/Process Spawning - is there a better platform friendly way to do this (spawn a process and grad stdout from it)? I have found some odd stuff in Python in this area (e.g. os.system("chmod +X") works but os.chmod(file) does not!)