Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '__init__': 0.09; 'get.': 0.09; 'subject:command': 0.09; 'subject:module': 0.09; 'subject:using': 0.09; 'posted': 0.15; '**kwargs)': 0.16; 'andreas': 0.16; 'argument.': 0.16; 'bye,': 0.16; 'expects': 0.16; 'fp:': 0.16; 'typeerror:': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; "skip:' 30": 0.19; '>>>': 0.22; 'import': 0.22; 'error': 0.23; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'specified': 0.30; 'code': 0.31; "skip:' 10": 0.31; '"",': 0.31; 'work:': 0.31; 'file': 0.32; 'running': 0.33; '(most': 0.33; 'skip:_ 10': 0.34; 'subject:with': 0.35; 'basic': 0.35; "can't": 0.35; 'skip:s 30': 0.35; 'convert': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'object,': 0.36; 'charset:us-ascii': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'first': 0.61; 'received:194': 0.64 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=bAL99Sv1YBYUJn8LhrjCweenR8BnHWxMHk7h0QtXaLU=; b=oZUlHifDFkV9HWIfMNu7B+B94mBJQUz6BRto9MRb/V05WFrwiJizcQw0wRVQ/JChDT Lp4N9AcMedKEi58/2qRmlxMjh1W0ZE9UsoSIY4g+WWm1ulD0tzeLxszdynyl3Q9gQg2p IqtKQfkyjHw3+q3BU9Ug1Bp7Sz8LGwX5lCSRO9MkwZY2n3HtYAdgomrVvJiKB3adWc00 GhvbD1KYgptyqIf5dLAobYLQf1ZyPD4F2ssTHqcTzsfps9nvT1SE3vyu0hyjK/8ps+U8 oBk1EWEM1qWNCCMimIt0hnj2te6cQVOBlw4juuEnwdYmfSqzul+ehtf3b8CSsrR9pALl wI9g== X-Received: by 10.14.208.199 with SMTP id q47mr6638029eeo.77.1386149911191; Wed, 04 Dec 2013 01:38:31 -0800 (PST) Date: Wed, 4 Dec 2013 10:38:27 +0100 From: Andreas Perstinger To: python-list@python.org Subject: Re: using ffmpeg command line with python's subprocess module In-Reply-To: <35c86484-d0dd-4954-adee-cde3a2fd7ac1@googlegroups.com> References: <3104d38f-3fca-43b0-b6a4-b600684f765e@googlegroups.com> <6fb2b162-cf9b-4c1c-bf5f-f14baf5baac4@googlegroups.com> <35c86484-d0dd-4954-adee-cde3a2fd7ac1@googlegroups.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386150418 news.xs4all.nl 2925 [2001:888:2000:d::a6]:38993 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61001 iMath wrote: >I use the following code to do the test ,but error occurred ,it >prompts system cannot find specified files ,but the files are indeed >exists there ,any help ? > >with tempfile.TemporaryFile() as fp: > fp.write(("file '"+'a1.mp3'+"'\n").encode('utf-8')) > fp.write(("file '"+'a2.mp3'+"'\n").encode('utf-8')) > > subprocess.call(['ffmpeg/ffmpeg', '-f', 'concat','-i',fp, '-c', > 'copy', 'a3.mp3']) Basic rule: Always copy'n'paste the exact traceback you get. I don't think you are running the code you have posted because your subprocess call doesn't work: >>> import tempfile, subprocess >>> with tempfile.TemporaryFile() as fp: ... subprocess.call(["foo", "bar", fp, "baz"]) ... Traceback (most recent call last): File "", line 2, in File "/usr/lib/python3.3/subprocess.py", line 520, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib/python3.3/subprocess.py", line 820, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.3/subprocess.py", line 1380, in _execute_child restore_signals, start_new_session, preexec_fn) TypeError: Can't convert '_io.BufferedRandom' object to str implicitly "fp" is a file object, but subprocess expects a list of strings as its first argument. Bye, Andreas