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


Groups > comp.lang.python > #61468

Re: using ffmpeg command line with python's subprocess module

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andipersti@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:command': 0.09; 'subject:module': 0.09; 'subject:using': 0.09; 'andreas': 0.16; 'bye,': 0.16; 'fp:': 0.16; 'letting': 0.16; 'skip:> 20': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'later': 0.20; '>>>': 0.22; 'import': 0.22; 'otherwise,': 0.22; 'creating': 0.23; 'nearly': 0.26; 'permission': 0.26; 'header:In-Reply-To:1': 0.27; 'thus': 0.29; "doesn't": 0.30; 'asked': 0.31; 'convenience': 0.31; 'file': 0.32; 'another': 0.32; 'linux': 0.33; 'subject:with': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'charset:us- ascii': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.38; "couldn't": 0.39; 'itself': 0.39; 'delete': 0.39; 'to:addr:python.org': 0.39; 'skip:n 10': 0.64; 'temporary': 0.65; 'received:178': 0.74; 'persistent': 0.84
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=AjghgyPETRdgJHLKx0pTvigFJCzGTqI7yJEZ5yEPtus=; b=1I4fh9gjT1MFp30BQVBXt9RH6usd8L1vqOEiXnqlbqrwwf7LdZUtOKwEWmpCnTzzKw QIQOzeY1pqyBzkqLcdZbrWF/H6ET5WdJ3+cXO37RlTPWiSc9f6UTWQLisPROaMz0RmFN PpCOntWini3hpQhIyNcy1c9n12AXabOhxTFRIKOqhV41Qgjhu2Ulmr4dej9fuUbfvIzW Van8cIRqi81cMqv9vnyD/mBUSh+B/zzKTCT7gAiE9YtG++3eRSS+5GmR2cakZTcTaTaj 1Giy3ocH6NeW5moY5I4aIgtTcfNs//MkLWMw6dXzpP0AtwdSZ9qFA8nI1mokxz/nq58P otGw==
X-Received by 10.14.208.199 with SMTP id q47mr12536521eeo.77.1386680392102; Tue, 10 Dec 2013 04:59:52 -0800 (PST)
Date Tue, 10 Dec 2013 13:59:47 +0100
From Andreas Perstinger <andipersti@gmail.com>
To python-list@python.org
Subject Re: using ffmpeg command line with python's subprocess module
In-Reply-To <6030eab0-17f7-4b7b-b057-d0889031b3d2@googlegroups.com>
References <d344154e-1de9-4016-b1fc-d1e9d989529d@googlegroups.com> <CAPTjJmrG+ik5=kOxC5AYg2BFe2F3CzWmAREReuw9-w=TuDuPuQ@mail.gmail.com> <mailman.3478.1386019175.18130.python-list@python.org> <3104d38f-3fca-43b0-b6a4-b600684f765e@googlegroups.com> <6fb2b162-cf9b-4c1c-bf5f-f14baf5baac4@googlegroups.com> <35c86484-d0dd-4954-adee-cde3a2fd7ac1@googlegroups.com> <20131204103827.6c5332c6@Hof> <mailman.3554.1386154312.18130.python-list@python.org> <60f2e393-658c-4e18-85b1-fc7d0b07ddb4@googlegroups.com> <mailman.3652.1386341991.18130.python-list@python.org> <6030eab0-17f7-4b7b-b057-d0889031b3d2@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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3827.1386683859.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386683859 news.xs4all.nl 2878 [2001:888:2000:d::a6]:56661
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61468

Show key headers only | View raw


iMath <redstone-cold@163.com> wrote:
>we don't have permission to use the temporary file while it has not
>been closed,but when the file is closed , it will be destroyed by
>default(delete=True),but once we set delete=False,then we couldn't
>depend on the convenience of letting the temporary file automatically
>delete itself after it has been used(then we have to delete it later
>by os.remove()) ,thus there is nearly no convenience in creating a
>temporary file or a persistent one when using NamedTemporaryFile.

In your OP you asked for a platform independent solution thus I don't
think it's possible to do what you want if the OS doesn't support
opening a file another time while it's still open.

Otherwise, on my Linux system this works:

>>> import tempfile, subprocess
>>> with tempfile.NamedTemporaryFile() as fp:                                   
...   fp.write(b"foo\nbar\nbaz\n")
...   fp.flush()
...   subprocess.call(["cat", fp.name])
... 
12
foo
bar
baz
0

Bye, Andreas

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


Thread

using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-02 03:34 -0800
  Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-02 22:40 +1100
  Re: using ffmpeg command line with python's subprocess module Ben Finney <ben+python@benfinney.id.au> - 2013-12-03 08:19 +1100
    Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-02 17:15 -0800
      Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-02 17:42 -0800
        Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-03 17:42 -0800
        Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-03 17:42 -0800
          Re: using ffmpeg command line with python's subprocess module Andreas Perstinger <andipersti@gmail.com> - 2013-12-04 10:38 +0100
            Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-05 22:23 -0800
              Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 09:23 +0000
                Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-06 06:52 -0800
                Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 15:12 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 07:15 -0800
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 07:13 -0800
                Re: using ffmpeg command line with python's subprocess module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-06 15:34 +0000
                Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 15:53 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 08:19 -0800
                Re: using ffmpeg command line with python's subprocess module Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-06 16:25 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 08:45 -0800
                Re: using ffmpeg command line with python's subprocess module MRAB <python@mrabarnett.plus.com> - 2013-12-06 16:41 +0000
                Re: using ffmpeg command line with python's subprocess module rusi <rustompmody@gmail.com> - 2013-12-06 08:53 -0800
                Re: using ffmpeg command line with python's subprocess module Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-12-07 13:01 +1300
              Re: using ffmpeg command line with python's subprocess module Ned Batchelder <ned@nedbatchelder.com> - 2013-12-06 06:31 -0500
          Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-04 21:51 +1100
            Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-06 06:54 -0800
              Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-07 01:59 +1100
                Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-09 01:04 -0800
                Re: using ffmpeg command line with python's subprocess module Andreas Perstinger <andipersti@gmail.com> - 2013-12-10 13:59 +0100
    Re: using ffmpeg command line with python's subprocess module Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-12-03 10:33 +0100
      Re: using ffmpeg command line with python's subprocess module iMath <redstone-cold@163.com> - 2013-12-03 05:59 -0800
  Re: using ffmpeg command line with python's subprocess module Chris Angelico <rosuav@gmail.com> - 2013-12-03 08:25 +1100

csiph-web