Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread eryksun
On Wed, Sep 4, 2013 at 7:11 AM, Oscar Benjamin wrote: > On 4 September 2013 11:42, eryksun wrote: si = subprocess.STARTUPINFO() si.dwFlags |= subprocess.STARTF_USESHOWWINDOW si.wShowWindow = subprocess.SW_HIDE >>> >>> Do these statements modify module-level state? Or do

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread Oscar Benjamin
On 4 September 2013 11:42, eryksun wrote: >>> si = subprocess.STARTUPINFO() >>> si.dwFlags |= subprocess.STARTF_USESHOWWINDOW >>> si.wShowWindow = subprocess.SW_HIDE >> >> Do these statements modify module-level state? Or do you need to pass >> startupinfo=si when calling Popen? > > It

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread eryksun
On Wed, Sep 4, 2013 at 6:22 AM, Oscar Benjamin wrote: > On 4 September 2013 11:11, eryksun wrote: > >> Using shell=True also sets startupinfo to hide the window. If that's >> the only reason you're using the shell, you may as well cut out the >> middleman (and potential security hole). Set startu

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread Oscar Benjamin
On 4 September 2013 11:11, eryksun wrote: > On Wed, Sep 4, 2013 at 5:14 AM, learner404 wrote: >> >> Yes, this worked :) >> >> subprocess.Popen(["ffmpeg","-f","dshow","-i","video="+videoinputName,"-f", >> "dshow","-i","audio="+audioinputName,"-q","5","%s"%videoFileOutput], >> shell=True) You shou

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread eryksun
On Wed, Sep 4, 2013 at 5:14 AM, learner404 wrote: > > Yes, this worked :) > > subprocess.Popen(["ffmpeg","-f","dshow","-i","video="+videoinputName,"-f", > "dshow","-i","audio="+audioinputName,"-q","5","%s"%videoFileOutput], > shell=True) Using shell=True also sets startupinfo to hide the window.

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread learner404
Thanks a lot Oscar and Eryksun for all the explanations and answers, I really appreciate. "So the extra quotes used for the video and audio arguments do actually get passed through to ffmpeg causing confusion." Yes, this worked :) subprocess.Popen(["ffmpeg","-f","dshow","-i","video="+videoinputNa

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-03 Thread Oscar Benjamin
On 3 September 2013 14:48, eryksun wrote: >> It occurs to me that another possibility is if ffmpeg isn't really an >> .exe on PATH but rather a .bat file or something. In that case >> os.system or subprocess shell=True would pick it up but subprocess >> shell=False might not. I say "might" because

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-03 Thread eryksun
On Tue, Sep 3, 2013 at 5:54 AM, Oscar Benjamin wrote: > On 3 September 2013 05:49, eryksun wrote: > > I've previously tried to find documentation that explains how MSVCRT > handles this. I didn't find anything as explicit as the explanation in > the subprocess docs. For example: > http://msdn.mic

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-03 Thread Oscar Benjamin
On 3 September 2013 05:49, eryksun wrote: > On Mon, Sep 2, 2013 at 10:19 AM, learner404 wrote: >> >> I can't understand why the command below works with os.system but not with >> subprocess.Popen (on windows, recording video with FFMPEG.exe) >> >> cmd=('ffmpeg -f dshow -i video="%s" -f dshow -i a

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-02 Thread eryksun
On Mon, Sep 2, 2013 at 10:19 AM, learner404 wrote: > > I can't understand why the command below works with os.system but not with > subprocess.Popen (on windows, recording video with FFMPEG.exe) > > cmd=('ffmpeg -f dshow -i video="%s" -f dshow -i audio="%s" -q 5 "%s"')% > (videoinputName, audioinp

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-02 Thread Oscar Benjamin
On 2 September 2013 15:19, learner404 wrote: > Hello, > > I can't understand why the command below works with os.system but not with > subprocess.Popen (on windows, recording video with FFMPEG.exe) > > cmd=('ffmpeg -f dshow -i video="%s" -f dshow -i audio="%s" -q 5 > "%s"')%(videoinputName, audioi

[Tutor] os.system vs subprocess.Popen args problems

2013-09-02 Thread learner404
Hello, I can't understand why the command below works with os.system but not with subprocess.Popen (on windows, recording video with FFMPEG.exe) cmd=('ffmpeg -f dshow -i video="%s" -f dshow -i audio="%s" -q 5 "%s"')%(videoinputName, audioinputName, videoFileOutput) os.system(cmd) *works* subpro