Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3509

Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!cyclone02.ams2.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe14.ams2.POSTED!00000000!not-for-mail
Content-Type text/plain; charset=us-ascii; format=flowed; delsp=yes
Newsgroups comp.lang.python
Subject Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?
References <8bb1fd96-91bf-42f6-a7ea-ab060cd22f66@a19g2000prj.googlegroups.com>
MIME-Version 1.0
Content-Transfer-Encoding 8bit
From "Rhodri James" <rhodri@wildebst.demon.co.uk>
Message-ID <op.vt5qhz1za8ncjz@gnudebst> (permalink)
User-Agent Opera Mail/11.10 (Linux)
Lines 39
NNTP-Posting-Host 82.8.62.87
X-Complaints-To http://netreport.virginmedia.com
X-Trace newsfe14.ams2 1303169749 82.8.62.87 (Mon, 18 Apr 2011 23:35:49 UTC)
NNTP-Posting-Date Mon, 18 Apr 2011 23:35:49 UTC
Organization virginmedia.com
Date Tue, 19 Apr 2011 00:35:49 +0100
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3509

Show key headers only | View raw


On Tue, 19 Apr 2011 00:07:46 +0100, goldtech <goldtech@worldpost.com>  
wrote:

> Trying to learn how to run a linux command and get the stdout and
> stderr. I'm trying the following:
>
>>>> cmd3 = r'ffmpeg -i /home/giga/Desktop/Guitar1.flv'
>>>> p = Popen(cmd3, stdout=PIPE, stderr=PIPE)
>
> Traceback (most recent call last):
>   File "<pyshell#73>", line 1, in <module>
>     p = Popen(cmd3, stdout=PIPE, stderr=PIPE)
>   File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
>     errread, errwrite)
>   File "/usr/lib/python2.6/subprocess.py", line 1141, in
> _execute_child
>     raise child_exception
> OSError: [Errno 2] No such file or directory


This is something that catches everyone!  From the Fine Manual  
(http://docs.python.org/library/subprocess.html#using-the-subprocess-module):

> On Unix, with shell=False (default): In this case, the Popen class
> uses os.execvp() to execute the child program. args should normally
> be a sequence. If a string is specified for args, it will be used
> as the name or path of the program to execute; this will only work
> if the program is being given no arguments.

What you actually want is more like:

p = Popen(('ffmpeg', '-i', '/home/giga/Desktop/Guitar1.flv'),
           stdout=PIPE, stderr=PIPE)

The manual gives you an example of using shlex to split a string
into tokens if you'd rather do it that way.

-- 
Rhodri James *-* Wildebeest Herder to the Masses

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Popen to get stdout and stderr for ffmpeg - No such file or directory ? goldtech <goldtech@worldpost.com> - 2011-04-18 16:07 -0700
  Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ? "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2011-04-19 00:35 +0100
  Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ? Chris Rebert <clp2@rebertia.com> - 2011-04-18 16:36 -0700
    Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ? goldtech <goldtech@worldpost.com> - 2011-04-18 20:05 -0700

csiph-web