Kodi Community Forum

Full Version: Python POpen - works on Win, OE/Linux but not OSX
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The following code:

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!)
Bump - any Mac people have any ideas about this??