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

Date 2013-12-10 13:59 +0100
From Andreas Perstinger <andipersti@gmail.com>
Subject Re: using ffmpeg command line with python's subprocess module
References (6 earlier) <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>
Newsgroups comp.lang.python
Message-ID <mailman.3827.1386683859.18130.python-list@python.org> (permalink)

Show all headers | 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