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


Groups > comp.lang.python > #3510

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!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'ok.': 0.04; '>>>>': 0.09; 'args,': 0.09; 'interpreting': 0.09; 'skip:o 50': 0.09; 'unix,': 0.09; 'pm,': 0.11; 'linux': 0.11; 'received:74.125.82.44': 0.14; 'received:mail-ww0-f44.google.com': 0.14; 'wrote:': 0.14; '"on': 0.16; '[errno': 0.16; '__init__': 0.16; 'oserror:': 0.16; 'stderr.': 0.16; 'stdout': 0.16; 'subject:file': 0.16; 'traceback': 0.16; '(most': 0.16; 'thanks,': 0.17; 'url:blog': 0.18; 'fine': 0.18; 'command': 0.19; 'obviously': 0.20; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'header :In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'mon,': 0.22; 'specified': 0.22; 'trying': 0.23; 'last):': 0.23; "i'm": 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'string': 0.29; 'hi,': 0.29; 'skip:" 30': 0.29; "skip:' 30": 0.29; 'named': 0.30; 'cc:addr:python.org': 0.31; 'url:library': 0.31; 'url:docs': 0.33; 'file': 0.35; 'finding': 0.35; '"",': 0.35; 'subject: ?': 0.35; 'appreciated.': 0.36; 'error.': 0.36; 'url:python': 0.37; 'run': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'url:org': 0.38; 'used': 0.38; 'help': 0.39; 'how': 0.39; 'works': 0.40; 'header:Received:5': 0.40; 'learn': 0.60; 'exact': 0.60; '2011': 0.62; 'subject:such': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ycgAJKbsU70jvUFScE2ymUojEHia4bNfmdV2B5QRtqc=; b=I566iB61NpCIXghms6/j2WQ866tQEawBvZ4Il+Ggo53dQx1H0pxac8rt6ZqCLARUic Er4bLBZXrE4PM9kb+zLS8i5uWJlwwSm/lSvnGVroi8o68fg2OaK9GUYcVy58zfX+p1tc 7DCLMWeSsnsdbbFxCm3xv2K2Jl4YHUtenyb9o=
DomainKey-Signature a=rsa-sha1; c=nofws; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=ELJNG36M/rh7fNGdwUyVMtCuTx56nDJRQcNcKTc5MtSJq0oorpKxJOepZGtXA+A22q sP4UGa7vgRfslUuSzVbMO9TWPqkF2/+2Fd3gz4Atvrv8kapBPV2LsTTzDyImF63ygkIn OKbIGCBMLu/kvkJmb+RJkiyF4S7uh/V434GKA=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <8bb1fd96-91bf-42f6-a7ea-ab060cd22f66@a19g2000prj.googlegroups.com>
References <8bb1fd96-91bf-42f6-a7ea-ab060cd22f66@a19g2000prj.googlegroups.com>
Date Mon, 18 Apr 2011 16:36:06 -0700
X-Google-Sender-Auth lFRFzvna6sau0ok_RQOvLxI6s0k
Subject Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?
From Chris Rebert <clp2@rebertia.com>
To goldtech <goldtech@worldpost.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.530.1303169769.9059.python-list@python.org> (permalink)
Lines 45
NNTP-Posting-Host 82.94.164.166
X-Trace 1303169769 news.xs4all.nl 81483 [::ffff:82.94.164.166]:52717
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3510

Show key headers only | View raw


On Mon, Apr 18, 2011 at 4:07 PM, goldtech <goldtech@worldpost.com> wrote:
> Hi,
>
> 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
>
> But:
>
>>>> if os.path.exists(r'/home/giga/Desktop/Guitar1.flv'):
>        print "exist"
<snip>
> Also if I run the exact command (cmd3) in the terminal it works OK.
> Why is it not finding the file? Thanks, help appreciated.

Read The Fine Manual:
http://docs.python.org/library/subprocess.html#subprocess.Popen :
"On Unix, with shell=False (default): [...] 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.***" (emphasis added)

The system is interpreting the entire command string as the path to an
executable; obviously there's no directory named "ffmpeg -i ", so the
path is invalid, hence the error.

Try instead:
cmd3 = ['ffmpeg', '-i', '/home/giga/Desktop/Guitar1.flv']

Cheers,
Chris
--
http://blog.rebertia.com

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