Python POpen - works on Win, OE/Linux but not OSX

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
bossanova808 Online
Donor
Posts: 2,308
Joined: Sep 2009
Reputation: 36
Location: Melbourne, Australia
Post: #1
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!)

My XBMC stuff:
find quote
bossanova808 Online
Donor
Posts: 2,308
Joined: Sep 2009
Reputation: 36
Location: Melbourne, Australia
Post: #2
Bump - any Mac people have any ideas about this??

My XBMC stuff:
find quote