Capturing output from child processes
#1
I'm simply trying to run par2.exe to check on the integrity of a set of files. I have had a devil of a time using os.popen, os.system, and subprocess.Popen on Windows to accomplish this.

The only one that I've gotten to work at all (i.e. actually run the command) is os.system by redirecting output to a file and reading that output, but I can't get os.system to support running an executable in quotes while at the same time passing arguments (i.e. '"c:/path with spaces/par2.exe" v -q "c:/path with spaces/some.par2"') which is pretty important if I want to ship the par2.exe with my plugin and not put it in c:\temp.

Any word from the developers on fixing this capability? Upgrading python to 2.6 would probably fix it, what's the hold up on that?
Reply
#2
think you need to double quote them.

'""c:/path with spaces/par2.exe" v -q "c:/path with spaces/some.par2""'
Reply
#3
Actually I think os.system has problems with spaces in paths in general. Had the problem, too. Switched to subprocess.Popen.
Reply
#4
d0n, how did you get subprocess.Popen to work? I assume you were piping in from stdout? How did you avoid the "expects and integer" error without XBMC crashing?
Reply
#5
Actually I'm still fighting with it Sad I tried so much crap over the last days, tried even to write the command to a batch file with > to output it to a file and read that. The problem is that I can't read it while it get's written but if I understand you right you don't need real time output? But I hope there is some better way to get it.
Oh, and one question to you, is only my debug logging broken? I get only outputs that I send with print, no real traceback or whatever anymore. Do you have that too?


And I also want a Python update
Reply

Logout Mark Read Team Forum Stats Members Help
Capturing output from child processes0