On 4 September 2013 11:11, eryksun <eryk...@gmail.com> wrote: > On Wed, Sep 4, 2013 at 5:14 AM, learner404 <learner...@gmail.com> wrote: >> >> Yes, this worked :) >> >> subprocess.Popen(["ffmpeg","-f","dshow","-i","video="+videoinputName,"-f", >> "dshow","-i","audio="+audioinputName,"-q","5","%s"%videoFileOutput], >> shell=True)
You should use subprocess.check_call() rather than subprocess.Popen. subprocess.check_call() waits for the command to complete and detects when an error has occurred in the child process and turns it into a Python error which is normally what you want to happen before any subsequent code runs. >From the subprocess docs: "The recommended approach to invoking subprocesses is to use the following convenience functions for all use cases they can handle. For more advanced use cases, the underlying Popen interface can be used directly." http://docs.python.org/2/library/subprocess.html#using-the-subprocess-module I'm pretty sure that your problem does not come under the "more advanced" use cases of subprocess. > 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 startupinfo=si, where si > is defined like this: I think it should just be possible to use shell=False here. > 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? Oscar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor