Re: Where is getstatusoutput() in subprocess module?

2019-05-03 Thread MRAB
ed to the subprocess module. Where are they? Here: https://docs.python.org/3/library/subprocess.html#subprocess.getstatusoutput -- https://mail.python.org/mailman/listinfo/python-list

Re: Where is getstatusoutput() in subprocess module?

2019-05-03 Thread Grant Edwards
utput() have been moved to the subprocess > module. > > Where are they? Doh, never mind. They were only moved in Python3. I didn't realize that the "In Python 3.x" qualifier from the beginning of the previous sentence applied to the entire paragraph. -- Grant Edwards

Where is getstatusoutput() in subprocess module?

2019-05-03 Thread Grant Edwards
I'm trying to update a python2 app to make it python3 compatible. It uses commands.getstatusoutput(), which according to https://docs.python.org/2/library/commands.html#commands.getstatusoutput ... getstatusoutput() and getoutput() have been moved to the subprocess module. Where are

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-12 Thread Chris Angelico
On Mon, Nov 12, 2018 at 11:20 PM Anssi Saari wrote: > > Chris Angelico writes: > > > On Fri, Nov 9, 2018 at 11:11 PM Anssi Saari wrote: > >> > >> Chris Angelico writes: > >> > >> > No helper needed. Safe against command injection. Uses the known > >> > format of the command's output; if you wan

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-12 Thread Anssi Saari
Chris Angelico writes: > On Fri, Nov 9, 2018 at 11:11 PM Anssi Saari wrote: >> >> Chris Angelico writes: >> >> > No helper needed. Safe against command injection. Uses the known >> > format of the command's output; if you want other information as well >> > as the type, you could get that too.

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-09 Thread Cousin Stanley
srinivasan wrote: > Even after changing as per the below > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > or: > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > or: > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > Still my output is: > */dev/mmcblk1p1: LABEL="efi" UUID="1084

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-09 Thread Chris Angelico
On Fri, Nov 9, 2018 at 11:11 PM Anssi Saari wrote: > > Chris Angelico writes: > > > No helper needed. Safe against command injection. Uses the known > > format of the command's output; if you want other information as well > > as the type, you could get that too. > > Can someone let me in on this

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-09 Thread Anssi Saari
Chris Angelico writes: > No helper needed. Safe against command injection. Uses the known > format of the command's output; if you want other information as well > as the type, you could get that too. Can someone let me in on this secret helper module? Doesn't seem to match the helper module in

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread srinivasan
Many Thanks a lot , I can use for reliably "lsblk %s -n -o FSTYPE" in the reused code of mine as below cmd = "lsblk %s -n -o FSTYPE" % partition_path return self._helper.execute_cmd_output_string(cmd) I really appreciate for all your support w.r.t this.. I feel I have kick start

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread Ben Bacarisse
srinivasan writes: > Even after changing as per the below > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > or: > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > or: > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > Still my output is: > */dev/mmcblk1p1: LABEL="efi" UUID="108

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread Chris Angelico
On Wed, Nov 7, 2018 at 11:42 PM srinivasan wrote: > > Some I managed to fix temporarily as below, might be useful for others. Also > please correct me if anything wrong or for any improvements in the below > > cmd = "blkid -o export %s" % partition_path > out = self._helper.execut

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread srinivasan
Some I managed to fix temporarily as below, might be useful for others. Also please correct me if anything wrong or for any improvements in the below cmd = "blkid -o export %s" % partition_path out = self._helper.execute_cmd_output_string(cmd) var = out.split("TYPE=", 1)[1]

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread Chris Angelico
On Wed, Nov 7, 2018 at 11:36 PM Qian Cai wrote: > > srinivasan wrote: > > Even after changing as per the below > > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > > or: > > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > > or: > > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" >

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread Qian Cai
srinivasan wrote: > Even after changing as per the below > "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" > or: > 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' > or: > "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" > > Still my output is: > */dev/mmcblk1p1: LABEL="efi" UUID="1084

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread srinivasan
Even after changing as per the below "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" or: 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' or: "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3" Still my output is: */dev/mmcblk1p1: LABEL="efi" UUID="1084-AA42" TYPE="vfat"* My expected outp

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread Brian J. Oney via Python-list
On Wed, 2018-11-07 at 10:22 +0100, srinivasan wrote: > blkid -o export %s | grep \'TYPE\' | cut -d\"=\" -f3 You don't need to escape the single quotes. Try either: "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3" or: 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3' or: "blkid -o export %s | g

Re: [Tutor] SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-07 Thread srinivasan
x27;TYPE' | cut -d" > and BETA=" -f3" > > Other issues may also be there. > -Original Message- > From: Tutor On Behalf Of > Alan Gauld via Tutor > Sent: Tuesday, November 6, 2018 7:37 PM > To: tu...@python.org > Cc: python-...@python.org > Subje

Re: SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-06 Thread Rhodri James
On 06/11/2018 18:10, srinivasan wrote: root:~/qa/test_library# python3 sd.py File "sd.py", line 99 *cmd = "blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)* * ^* *SyntaxError: can't assign to literal* Look at the 'cut' element of the pipeline. You have used double quotes

SyntaxError: can't assign to literal while using ""blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % (fs)" using subprocess module in Python

2018-11-06 Thread srinivasan
Dear Python Experts Team, As am newbie to python development, I am trying to use the below function to get verify the filesystem type of the SD card parition using bash command in python using subprocess module, I ma seeing the below Error "SyntaxError: can't assign to liter

use of subprocess module inside generator

2015-05-13 Thread Peter
Gary, Thank you for the response. I made a small typo in my original post, which you correctly picked up. My original generator actually did not have the stdout parameter (see below). Only the new generator has this parameter, as it's now being passed into the generator from the caller's e

Re: use of subprocess module inside generator

2015-05-13 Thread Gary Herron
alled on the returned generator. I verified this behavior with print statements inside my code, as well as, inside the subprocess module. My work around was to simply move the call to subprocess.check_output outside of the generator function (see below) to its caller (a non-generator function). With

use of subprocess module inside generator

2015-05-13 Thread Peter
e to send its output to stdout. However, if the command line directed sqlcmd.exe to send its output to a file, subprocess.check_output would never be called when next was called on the returned generator. I verified this behavior with print statements inside my code, as well as, inside th

Re: Struggling with python-daemon and subprocess module to work together

2014-10-21 Thread Ben Finney
Praveen Kumar writes: > Previously this basic server is executed using *openvt* but I thought > it would be nice to have a daemon process for it and used > python-daemon. An important difference is that a daemon process has no controlling terminal, by definition. > Issue I am facing is after so

Re: Struggling with python-daemon and subprocess module to work together

2014-10-21 Thread Dan Stromberg
On Mon, Oct 20, 2014 at 2:16 AM, Praveen Kumar wrote: > I am writing a very basic server side application[0] which get data > from a client and create a virtual machine using provided data and > also tells client about what's going on during *virt-install* command > execution. Previously this basi

Struggling with python-daemon and subprocess module to work together

2014-10-21 Thread Praveen Kumar
Hi, I am writing a very basic server side application[0] which get data from a client and create a virtual machine using provided data and also tells client about what's going on during *virt-install* command execution. Previously this basic server is executed using *openvt* but I thought it would

Re: subprocess module usage

2014-09-01 Thread Akira Li
Earl Lapus writes: > Hi, > > I made simple test program using the subprocess module (see attached: > exec_cmd.py). I ran it passing variations of 'ls' command options. > > I encounter exceptions every time I use '-l' options. Example runs > where e

Re: subprocess module usage

2014-09-01 Thread Chris Angelico
On Mon, Sep 1, 2014 at 6:46 PM, Cameron Simpson wrote: > Not really. If the arguments are coming in from the command line, someone (a > user, even if that user is the programmer) typed them. Even if not > malicious, they can still be mistaken. Or just unfortunate. I'm guessing that what he means

Re: subprocess module usage

2014-09-01 Thread Cameron Simpson
On 01Sep2014 14:33, Earl Lapus wrote: On Mon, Sep 1, 2014 at 1:39 PM, Chris Angelico wrote: Glad it's working! But please, don't just take my word for it and make a black-box change to your code. When you invoke subprocesses, be sure you understand what's going on, and when shell=True is appro

Re: subprocess module usage

2014-08-31 Thread Earl Lapus
On Mon, Sep 1, 2014 at 1:39 PM, Chris Angelico wrote: > > Glad it's working! But please, don't just take my word for it and make > a black-box change to your code. When you invoke subprocesses, be sure > you understand what's going on, and when shell=True is appropriate and > when shell=False is a

Re: subprocess module usage

2014-08-31 Thread Earl Lapus
On Mon, Sep 1, 2014 at 11:55 AM, Chris Angelico wrote: > > But secondly, you're already splitting the argument (or rather, taking > it from your own parameters, already split), so you don't want to go > through the shell. In fact, going through the shell would only make > your life harder. Change

Re: subprocess module usage

2014-08-31 Thread Chris Angelico
On Mon, Sep 1, 2014 at 3:24 PM, Earl Lapus wrote: > On Mon, Sep 1, 2014 at 11:55 AM, Chris Angelico wrote: >> >> But secondly, you're already splitting the argument (or rather, taking >> it from your own parameters, already split), so you don't want to go >> through the shell. In fact, going thro

Re: subprocess module usage

2014-08-31 Thread Chris Angelico
On Mon, Sep 1, 2014 at 1:28 PM, Earl Lapus wrote: > So, what could be causing this behavior? Is this expected or is there > something wrong with how I'm using the subprocess module? The latter. Your problem is with your shell= option. Firstly, the parameter should be either shell=Tr

subprocess module usage

2014-08-31 Thread Earl Lapus
Hi, I made simple test program using the subprocess module (see attached: exec_cmd.py). I ran it passing variations of 'ls' command options. I encounter exceptions every time I use '-l' options. Example runs where exception occurs: # ./exec_cmd.py ls -al # ./exec_cmd.py ls -l

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

2013-12-10 Thread Andreas Perstinger
iMath 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 it

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

2013-12-09 Thread iMath
在 2013年12月6日星期五UTC+8下午10时59分43秒,Chris Angelico写道: > On Sat, Dec 7, 2013 at 1:54 AM, iMath wrote: > > > fp=tempfile.NamedTemporaryFile(delete=False) > > > fp.write(("file '"+fileName1+"'\n").encode('utf-8')) > > > fp.write(("file '"+fileName2+"'\n").encode('utf-8')) > > > > > > >

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

2013-12-06 Thread Gregory Ewing
rusi wrote: On Friday, December 6, 2013 10:11:04 PM UTC+5:30, MRAB wrote: You're exaggerating. It's more like 500 years ago. :-) I was going to say the same until I noticed the "the way people think English was spoken..." That makes it unarguable -- surely there are some people who (wrongly)

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

2013-12-06 Thread rusi
On Friday, December 6, 2013 10:11:04 PM UTC+5:30, MRAB wrote: > On 06/12/2013 15:34, Steven D'Aprano wrote: > > On Fri, 06 Dec 2013 06:52:48 -0800, iMath wrote: > >> yes ,I am a native Chinese speaker.I always post question by Google > >> Group not through email ,is there something wrong with it ?

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

2013-12-06 Thread rusi
On Friday, December 6, 2013 9:55:54 PM UTC+5:30, Mark Lawrence wrote: > On 06/12/2013 16:19, rusi wrote: > > So someone please update that page! > This is a community so why don't you? Ok done (at least a first draft) I was under the impression that anyone could not edit -- https://mail.python.

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

2013-12-06 Thread MRAB
On 06/12/2013 15:34, Steven D'Aprano wrote: On Fri, 06 Dec 2013 06:52:48 -0800, iMath wrote: yes ,I am a native Chinese speaker.I always post question by Google Group not through email ,is there something wrong with it ? your english is a little strange to me . Mark is writing in fake old-En

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

2013-12-06 Thread Mark Lawrence
On 06/12/2013 16:19, rusi wrote: On Friday, December 6, 2013 9:23:47 PM UTC+5:30, Mark Lawrence wrote: On 06/12/2013 15:34, Steven D'Aprano wrote: (if I remember correctly) I think Mark also sometimes posts a link to managing Google Groups. You do, and here it is https://wiki.python.org

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

2013-12-06 Thread rusi
On Friday, December 6, 2013 9:23:47 PM UTC+5:30, Mark Lawrence wrote: > On 06/12/2013 15:34, Steven D'Aprano wrote: > > (if I remember correctly) I think Mark also > > > sometimes posts a link to managing Google Groups. > > > > > You do, and here it is https://wiki.python.org/moin/GoogleGroupsP

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

2013-12-06 Thread Mark Lawrence
On 06/12/2013 15:34, Steven D'Aprano wrote: (if I remember correctly) I think Mark also sometimes posts a link to managing Google Groups. You do, and here it is https://wiki.python.org/moin/GoogleGroupsPython -- My fellow Pythonistas, ask not what our language can do for you, ask what you ca

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

2013-12-06 Thread Steven D'Aprano
On Fri, 06 Dec 2013 06:52:48 -0800, iMath wrote: > yes ,I am a native Chinese speaker.I always post question by Google > Group not through email ,is there something wrong with it ? your > english is a little strange to me . Mark is writing in fake old-English style, the way people think English

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

2013-12-06 Thread rusi
On Friday, December 6, 2013 8:42:02 PM UTC+5:30, Mark Lawrence wrote: > The English I used was archaic, please ignore it :) "Archaic" is almost archaic "Old" is ever-young :D -- https://mail.python.org/mailman/listinfo/python-list

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

2013-12-06 Thread rusi
On Friday, December 6, 2013 8:22:48 PM UTC+5:30, iMath wrote: > 在 2013年12月6日星期五UTC+8下午5时23分59秒,Mark Lawrence写道: > > On 06/12/2013 06:23, iMath wrote: > > Dearest iMath, wouldst thou be kind enough to partake of obtaining some > > type of email client that dost not sendeth double spaced data into t

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

2013-12-06 Thread Mark Lawrence
On 06/12/2013 14:52, iMath wrote: 在 2013年12月6日星期五UTC+8下午5时23分59秒,Mark Lawrence写道: On 06/12/2013 06:23, iMath wrote: Dearest iMath, wouldst thou be kind enough to partake of obtaining some type of email client that dost not sendeth double spaced data into this most illustrious of mailing lis

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

2013-12-06 Thread Chris Angelico
On Sat, Dec 7, 2013 at 1:54 AM, iMath wrote: > fp=tempfile.NamedTemporaryFile(delete=False) > fp.write(("file '"+fileName1+"'\n").encode('utf-8')) > fp.write(("file '"+fileName2+"'\n").encode('utf-8')) > > > subprocess.call(['ffmpeg', '-f', 'concat','-i',fp.name, '-c', 'copy', >

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

2013-12-06 Thread iMath
在 2013年12月4日星期三UTC+8下午6时51分49秒,Chris Angelico写道: > On Wed, Dec 4, 2013 at 8:38 PM, Andreas Perstinger > wrote: > > > "fp" is a file object, but subprocess expects a list of strings as > > > its first argument. > > > > More fundamentally: The subprocess's arguments must include the *name* >

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

2013-12-06 Thread iMath
在 2013年12月6日星期五UTC+8下午5时23分59秒,Mark Lawrence写道: > On 06/12/2013 06:23, iMath wrote: > > > > Dearest iMath, wouldst thou be kind enough to partake of obtaining some > > type of email client that dost not sendeth double spaced data into this > > most illustrious of mailing lists/newsgroups. T

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

2013-12-06 Thread Ned Batchelder
On 12/6/13 4:23 AM, Mark Lawrence wrote: On 06/12/2013 06:23, iMath wrote: Dearest iMath, wouldst thou be kind enough to partake of obtaining some type of email client that dost not sendeth double spaced data into this most illustrious of mailing lists/newsgroups. Thanking thee for thine partic

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

2013-12-06 Thread Mark Lawrence
On 06/12/2013 06:23, iMath wrote: Dearest iMath, wouldst thou be kind enough to partake of obtaining some type of email client that dost not sendeth double spaced data into this most illustrious of mailing lists/newsgroups. Thanking thee for thine participation in my most humble of requests.

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

2013-12-05 Thread iMath
在 2013年12月4日星期三UTC+8下午5时38分27秒,Andreas Perstinger写道: > 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: > >

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

2013-12-04 Thread Chris Angelico
On Wed, Dec 4, 2013 at 8:38 PM, Andreas Perstinger wrote: > "fp" is a file object, but subprocess expects a list of strings as > its first argument. More fundamentally: The subprocess's arguments must include the *name* of the file. This means you can't use TemporaryFile at all, as it's not guara

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

2013-12-04 Thread Andreas Perstinger
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

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

2013-12-03 Thread iMath
在 2013年12月3日星期二UTC+8上午9时42分11秒,rusi写道: > On Tuesday, December 3, 2013 6:45:42 AM UTC+5:30, iMath wrote: > > > so is there any way to create a temporary file by Python here ? > > > > http://docs.python.org/2/library/tempfile.html I use the following code to do the test ,but error occurred ,it pr

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

2013-12-03 Thread iMath
在 2013年12月3日星期二UTC+8上午9时42分11秒,rusi写道: > On Tuesday, December 3, 2013 6:45:42 AM UTC+5:30, iMath wrote: > > > so is there any way to create a temporary file by Python here ? > > > > http://docs.python.org/2/library/tempfile.html I use the following code to do the test ,but error occurred ,it pr

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

2013-12-03 Thread iMath
在 2013年12月3日星期二UTC+8下午5时33分09秒,Alain Ketterlin写道: > Ben Finney writes: > > > > > Chris Angelico writes: > > > > > >> On Mon, Dec 2, 2013 at 10:34 PM, iMath wrote: > > >> > ffmpeg -f concat -i <(for f in ./*.wav; do echo "file '$f'"; done) -c > >> > copy output.wav > > >> > ffmpeg -f conc

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

2013-12-03 Thread Alain Ketterlin
Ben Finney writes: > Chris Angelico writes: > >> On Mon, Dec 2, 2013 at 10:34 PM, iMath wrote: >> > ffmpeg -f concat -i <(for f in ./*.wav; do echo "file '$f'"; done) -c copy >> > output.wav >> > ffmpeg -f concat -i <(printf "file '%s'\n" ./*.wav) -c copy output.wav >> > ffmpeg -f concat -i <(

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

2013-12-02 Thread rusi
On Tuesday, December 3, 2013 6:45:42 AM UTC+5:30, iMath wrote: > so is there any way to create a temporary file by Python here ? http://docs.python.org/2/library/tempfile.html -- https://mail.python.org/mailman/listinfo/python-list

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

2013-12-02 Thread iMath
在 2013年12月3日星期二UTC+8上午5时19分21秒,Ben Finney写道: > Chris Angelico writes: > > > > > On Mon, Dec 2, 2013 at 10:34 PM, iMath wrote: > > > > ffmpeg -f concat -i <(for f in ./*.wav; do echo "file '$f'"; done) -c > > > copy output.wav > > > > ffmpeg -f concat -i <(printf "file '%s'\n" ./*.wav) -c co

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

2013-12-02 Thread Chris Angelico
On Tue, Dec 3, 2013 at 8:19 AM, Ben Finney wrote: > Chris Angelico writes: > >> On Mon, Dec 2, 2013 at 10:34 PM, iMath wrote: >> > ffmpeg -f concat -i <(for f in ./*.wav; do echo "file '$f'"; done) -c copy >> > output.wav >> > ffmpeg -f concat -i <(printf "file '%s'\n" ./*.wav) -c copy output.w

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

2013-12-02 Thread Ben Finney
Chris Angelico writes: > On Mon, Dec 2, 2013 at 10:34 PM, iMath wrote: > > ffmpeg -f concat -i <(for f in ./*.wav; do echo "file '$f'"; done) -c copy > > output.wav > > ffmpeg -f concat -i <(printf "file '%s'\n" ./*.wav) -c copy output.wav > > ffmpeg -f concat -i <(find . -name '*.wav' -printf

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

2013-12-02 Thread Chris Angelico
On Mon, Dec 2, 2013 at 10:34 PM, iMath wrote: > I have few wav files that I can use either of the following command line > mentioned here > https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files > to concatenate > > > ffmpeg -f concat -i <(for f in ./*.wav; do

using ffmpeg command line with python's subprocess module

2013-12-02 Thread iMath
y output.wav ffmpeg -f concat -i <(printf "file '%s'\n" ./*.wav) -c copy output.wav ffmpeg -f concat -i <(find . -name '*.wav' -printf "file '%p'\n") -c copy output.wav anyone know how to convert either of them to work with python's subproc

Re: os.popen and the subprocess module

2012-11-30 Thread emile
On 11/29/2012 10:39 AM, Nobody wrote: Every time I see your posts "Shanghai Noodle Factory" sticks in my head as my daily hummer. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: os.popen and the subprocess module

2012-11-29 Thread Nobody
On Thu, 29 Nov 2012 10:09:44 +0100, Thomas Rachel wrote: > The variant with shell=True is more os.popen()-like, but has security > flaws (e.g., what happens if there are spaces or, even worse, ";"s in the > command string? I think that you're conflating the shell= option with whether the command

Re: os.popen and the subprocess module

2012-11-29 Thread Thomas Rachel
Am 27.11.2012 19:00 schrieb Andrew: I'm looking into os.popen and the subprocess module, implementing os.popen is easy but i hear it is depreciating however I'm finding the implemantation of subprocess daunting can anyone help This is only the first impression. subprocess is

Re: os.popen and the subprocess module

2012-11-28 Thread Tim Roberts
Andrew wrote: > >I'm working on a script that will run an executable obtaine the output > from the executable >and do some analysis on the output. Essentially the script runs the >executable analyses >the data. >I'm looking into os.popen and the subprocess modu

Re: os.popen and the subprocess module

2012-11-27 Thread Mark Lawrence
On 27/11/2012 18:00, Andrew wrote: Hello world, I'm working on a script that will run an executable obtaine the output from the executable and do some analysis on the output. Essentially the script runs the executable analyses the data. I'm looking into os.popen and the subproc

RE: os.popen and the subprocess module

2012-11-27 Thread Prasad, Ramit
Andrew wrote: > > Hello world, > > I'm working on a script that will run an executable obtaine the output > from the executable > and do some analysis on the output. Essentially the script runs the > executable analyses > the data. > I'm looking in

os.popen and the subprocess module

2012-11-27 Thread Andrew
Hello world, I'm working on a script that will run an executable obtaine the output from the executable and do some analysis on the output. Essentially the script runs the executable analyses the data. I'm looking into os.popen and the subprocess module, implementing os.popen i

Re: How to print stdout before writing stdin using subprocess module in Python?

2012-07-23 Thread Nobody
On Mon, 23 Jul 2012 06:01:23 -0700, Sarbjit singh wrote: > proc = subprocess.Popen("cp -i a.txt b.txt", shell=True, > stdin=subprocess.PIPE, stdout=subprocess.PIPE, > stderr=subprocess.STDOUT,) > stdout_val, stderr_val = proc.communicate() > print stdout_val b.txt? > > proc.communicate("y") >

Re: How to print stdout before writing stdin using subprocess module in Python?

2012-07-23 Thread Peter Otten
Sarbjit singh wrote: > I am writing a script in which in the external system command may > sometimes require user input. I am not able to handle that properly. I > have tried using os.popen4 and subprocess module but could not achieve the > desired behavior. > > Below menti

How to print stdout before writing stdin using subprocess module in Python?

2012-07-23 Thread Sarbjit singh
I am writing a script in which in the external system command may sometimes require user input. I am not able to handle that properly. I have tried using os.popen4 and subprocess module but could not achieve the desired behavior. Below mentioned example would show this problem using &qu

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-17 Thread 88888 Dihedral
Check PY2EXE, PYREX and PSYChO. I must use these packages to relase commercial products with my own dll in c. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-17 Thread Vinay Sajip
On Feb 17, 1:49 pm, Jean-Michel Pichavant wrote: > I can't use it though, I'm still using a vintage 2.5 version :-/ That's a shame. I chose 2.6 as a baseline for this package, because I need it to work on Python 2.x and 3.x with the same code base and minimal work, and that meant supporting Unic

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-17 Thread Jean-Michel Pichavant
Vinay Sajip wrote: Sarge, a cross-platform library which wraps the subprocess module in the standard library, has been released. What does it do? Sarge tries to make interfacing with external programs from your Python applications easier than just using subprocess alone

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-13 Thread Vinay Sajip
On Feb 13, 7:08 am, Anh Hai Trinh wrote: > > Objection! Does the defense REALLY expect this court to believe that > > he can testify as to how MOST members of the Python community would or > > would not favor bash over Python? And IF they do in fact prefer bash, > > is this display of haughty arro

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-13 Thread Vinay Sajip
On Feb 13, 3:57 am, Anh Hai Trinh wrote: > > I don't disagree with it. But the solution is really easy, just call 'sh' and > pass it a string! > > >>> from extproc import sh > >>> n = int(sh(“ls /etc –1 | wc –l”)) > > No parser needed written! > > Yes there is a danger of argument parsing and gl

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
> Objection! Does the defense REALLY expect this court to believe that > he can testify as to how MOST members of the Python community would or > would not favor bash over Python? And IF they do in fact prefer bash, > is this display of haughty arrogance nothing more than a hastily > stuffed straw-

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Rick Johnson
On Feb 12, 2:13 pm, Vinay Sajip wrote: > wc(ls("/etc", "-1"), "-l") > > is not as readable as > > call(“ls /etc –1 | wc –l”) And i agree! I remember a case where i was forced to use an idiotic API for creating inputbox dialogs. Something like this: prompts = ['Height', 'Width', 'Color'] values

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Rick Johnson
On Feb 12, 9:35 am, Anh Hai Trinh wrote: > > It's not hard for the user > > I think most users like to use Python, or they'd use Bash. I think people > prefer not another language that is different from both, and having little > benefits. My own opinion of course. Objection! Does the defense RE

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
On Monday, February 13, 2012 3:13:17 AM UTC+7, Vinay Sajip wrote: > On Feb 12, 3:35 pm, Anh Hai Trinh wrote: > > > I think most users like to use Python, or they'd use Bash. I think people > > prefer not another language that is different from both, and having little > > benefits. My own opinio

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Vinay Sajip
On Feb 12, 4:19 pm, Anh Hai Trinh wrote: > If you use threads and call fork(), you'll almost guaranteed to face with > deadlocks. Perhaps not in a particular piece of code, but some others. > Perhaps not on your laptop, but on the production machine with different > kernels. Like most race con

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Vinay Sajip
s case. Even though it goes on to mention the dangers inherent in inherited file handles, it also mentions that these problems have been overcome in recent Linux kernels, and the subprocess module does contain code to handle at least some of these conditions (e.g. preexec_fn, close_fds keyword argum

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
> For a careful impl of fork-exec with threads, see > http://golang.org/src/pkg/syscall/exec_unix.go I forgot to mention that this impl is indeed "correct" only because you cannot start thread or call fork() directly in the Go language, other than use goroutines and the ForkExec() function impl

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
> It's not hard for the user I think most users like to use Python, or they'd use Bash. I think people prefer not another language that is different from both, and having little benefits. My own opinion of course. Re. threads & fork(): http://www.linuxprogrammingblog.com/threads-and-fork-think

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Vinay Sajip
On Feb 12, 9:41 am, Anh Hai Trinh wrote: > Having written something with similar purpose > (https://github.com/aht/extproc), here are my comments: > > * Having command parsed from a string is complicated. Why not just have an > OOP API to construct commands? It's not hard for the user, and less

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
Having written something with similar purpose (https://github.com/aht/extproc), here are my comments: * Having command parsed from a string is complicated. Why not just have an OOP API to construct commands? extproc does this, but you opted to write a recursive descent parser. I'm sure it's fun

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-11 Thread Rodrick Brown
On Fri, Feb 10, 2012 at 2:28 PM, Vinay Sajip wrote: > Sarge, a cross-platform library which wraps the subprocess module in > the standard library, has been released. > > What does it do? > > > Sarge tries to make interfacing with external programs from your

ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-11 Thread Vinay Sajip
Sarge, a cross-platform library which wraps the subprocess module in the standard library, has been released. What does it do? Sarge tries to make interfacing with external programs from your Python applications easier than just using subprocess alone. Sarge offers the

Re: subprocess module and long-lived subprocesses

2012-01-20 Thread Nobody
On Fri, 20 Jan 2012 08:42:16 -0600, skip wrote: > The library documentation doesn't talk a lot about long-lived subprocesses > other than the possibility of deadlock when using Popen.wait(). Ideally, I > would write to the subprocess's stdin, check for output on stdout and > stderr, then lather,

Re: subprocess module and long-lived subprocesses

2012-01-20 Thread skip
(Apologies for the non-threaded reply. My subscription to the list is currently set to no-mail and I can't get to gmane.org, so have no clean way to reply...) Mike Fletcher wrote: > Definitely *will* block, you have to explicitly set them non-blocking to > have non-blocking behaviour: ... >

Re: subprocess module and long-lived subprocesses

2012-01-20 Thread Mike C. Fletcher
On 12-01-20 09:42 AM, s...@pobox.com wrote: > I'm converting some os.popen calls to use subprocess.Popen. I had > previously been ignoring stdout and stderr when using os.popen. The primary > motivation to switch to subprocess.Popen now is that I now want to check > stderr, so would have to make

subprocess module and long-lived subprocesses

2012-01-20 Thread Skip Montanaro
I'm converting some os.popen calls to use subprocess.Popen. I had previously been ignoring stdout and stderr when using os.popen. The primary motivation to switch to subprocess.Popen now is that I now want to check stderr, so would have to make code changes to use os.popen[34] anyway. Might as w

Re: Problem in using subprocess module and communicate()

2011-05-23 Thread Tim Golden
[cc-ing back to the list; please keep the conversation over there...] On 23/05/2011 13:11, vijay swaminathan wrote: What I want to achieve is, I want to run a batch file on a command prompt. The reason for using thread is not for running multiple scripts simultaneously. It is just to monitor my

Re: Problem in using subprocess module and communicate()

2011-05-23 Thread Tim Golden
On 21/05/2011 16:56, vijay swaminathan wrote: I'm having some problem in using the communicate() along with the subprocess.I would like to invoke a command prompt and pass on a .bat file to execute. I went through the subprocess module and understood that using communicate, we can send the

Re: Problem in using subprocess module and communicate()

2011-05-21 Thread Chris Rebert
On Sat, May 21, 2011 at 8:56 AM, vijay swaminathan wrote: > Hi  Gurus, > > I'm having some problem in using the communicate() along with the > subprocess.I would like to invoke a command prompt and pass  on a .bat file > to execute. I went through the subprocess module and u

Problem in using subprocess module and communicate()

2011-05-21 Thread vijay swaminathan
Hi Gurus, I'm having some problem in using the communicate() along with the subprocess.I would like to invoke a command prompt and pass on a .bat file to execute. I went through the subprocess module and understood that using communicate, we can send the send data to stdin. According t

Re: subprocess module under python 2.7

2010-07-27 Thread Chris Rebert
                       close_fds=False, >                            universal_newlines=True, >                            startupinfo=startupinfo >                            ) > > This worked okay in using the subprocess module under python 2.6, but under > python 2.7 I get the error: &

  1   2   3   >