On Nov 8, 3:35 pm, Hans Mulder wrote:
> > Perhaps this example better demonstrates what is going on:
>
> p = subprocess.Popen(['echo one $0 three $1 five', 'two', 'four'],
> > ... shell=True)
> > one two three four five
>
> Maybe I'm thick, but I still don't understand.
In message <4cd87b24$0$81481$e4fe5...@news.xs4all.nl>, Hans Mulder wrote:
> But in this case the first positional argument is in $0.
That’s what confused me.
--
http://mail.python.org/mailman/listinfo/python-list
Ian wrote:
On Nov 8, 2:43 am, m...@distorted.org.uk (Mark Wooding) wrote:
I don’t know what happens to the extra arguments, but they just seem
to be ignored if -c is specified.
The argument to -c is taken as a shell script; the remaining arguments
are made available as positional parameters to
On Nov 8, 2:43 am, m...@distorted.org.uk (Mark Wooding) wrote:
> > I don’t know what happens to the extra arguments, but they just seem
> > to be ignored if -c is specified.
>
> The argument to -c is taken as a shell script; the remaining arguments
> are made available as positional parameters to t
Lawrence D'Oliveiro writes:
> In message , Chris Torek wrote:
>
> > ['/bin/sh', '-c', 'echo', '$MYVAR']
> >
> > (with arguments expressed as a Python list). /bin/sh takes the
> > string after '-c' as a command, and the remaining argument(s) if
> > any are assigned to positional parameters (
In message , Chris Torek wrote:
> ['/bin/sh', '-c', 'echo', '$MYVAR']
>
> (with arguments expressed as a Python list). /bin/sh takes the
> string after '-c' as a command, and the remaining argument(s) if
> any are assigned to positional parameters ($0, $1, etc).
Doesn’t work. I don’t know w
Hi,
Thanks everyone for the replies - it is now clearer.
Steven
--
http://mail.python.org/mailman/listinfo/python-list
In article <891a9a80-c30d-4415-ac81-bddd0b564...@g13g2000yqj.googlegroups.com>
moogyd wrote:
>[sde:st...@lbux03 ~]$ python
>Python 2.6 (r26:66714, Feb 21 2009, 02:16:04)
>[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
moogyd writes:
import os, subprocess
os.environ['MYVAR'] = "myval"
p = subprocess.Popen(['echo', '$MYVAR'],shell=True)
p = subprocess.Popen(['echo', '$MYVAR'])
$MYVAR
>
p = subprocess.Popen('echo $MYVAR',shell=True)
myval
>
p = subprocess.Popen('echo $
On Nov 4, 7:06 pm, moogyd wrote:
> Hi,
> I usually use csh for my simulation control scripts, but these scripts
> are becoming more complex, so I plan to use python for the next
> project.
> To this end, I am looking at subprocess.Popen() to actually call the
> simulations, and have a very basic q
Hi,
I usually use csh for my simulation control scripts, but these scripts
are becoming more complex, so I plan to use python for the next
project.
To this end, I am looking at subprocess.Popen() to actually call the
simulations, and have a very basic question which is demonstrated
below.
[sde:st.
In article ,
Tim Chase wrote:
>
>Darn "standards" :-/
The wonderful thing about standards is that there are so many to choose
from.
--
Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
"I support family values -- Addams family values" --www.nancybuttons.com
--
http
En Sun, 30 Aug 2009 17:25:40 -0300, Chris Rebert
escribió:
On Sun, Aug 30, 2009 at 12:33 PM, Sebastian wrote:
Hello World!
This is my first post on the list and I'm hoping it is the right forum
and
not OT, I've searched
a bit on this, but, none-the-wiser!
My question is on the Popen meth
On Sun, Aug 30, 2009 at 12:33 PM, Sebastian wrote:
> Hello World!
> This is my first post on the list and I'm hoping it is the right forum and
> not OT, I've searched
> a bit on this, but, none-the-wiser!
>
> My question is on the Popen method, here is my snippet:
>
>> p1 = Popen(["cat", "georgi_dd
Hello World!
This is my first post on the list and I'm hoping it is the right forum and
not OT, I've searched
a bit on this, but, none-the-wiser!
My question is on the Popen method, here is my snippet:
p1 = Popen(["cat", "georgi_ddr7_allmag_kcor_in_test.dat"], stdout=PIPE )
> p2 = Popen(["fit_coe
First, I think you should use subprocess.Popen (it's recommended by
PEP-324) instead of os.popen. For example:
p = subprocess.Popen(["top"], stdout = PIPE)
p.stdout.readlines()
And to write to stdin (in your case "q") you can use p.stdin.write("q"), or
terminate the process with p.terminate(
os.popen('top -n1').readlines()
Hm, interesting. On Mac OS X's (and BSD's?) top, -n instead specifies
the number of processes to list at a time (i.e. list only the top N
processes), which is entirely different.
[reaching over to my Mac] Looks like "top" there supports a -l
parameter which do
On Sun, Aug 30, 2009 at 4:43 AM, Tim Chase wrote:
>> texts = os.popen('top').readlines()
>> print texts
>>
>> It calls the command line "top" and will print out some texts.
>> But first I have to press the keyboard "q" to quit the subprocess "top",
>> then the texts will be printed, otherwise it ju
texts = os.popen('top').readlines()
print texts
It calls the command line "top" and will print out some texts.
But first I have to press the keyboard "q" to quit the subprocess "top", then
the texts will be printed, otherwise it just stands by with blank.
Question
is. Do you know how to give "q
Hi all,
I write a small script
texts = os.popen('top').readlines()
print texts
It calls the command line "top" and will print out some texts.
But first I have to press the keyboard "q" to quit the subprocess "top", then
the texts will be printed, otherwise it just stands by with blank.
Questio
thebiggestbangthe...@gmail.com wrote:
> On May 28, 5:31 am, Sebastian Wiesner wrote:
>>
>>
>>> Your best bet is to make sudo not ask for a password. :) If you
>>> don't have the rights, then you can use pexpect to do what you want to
>>> do. http://pexpect.sourceforge.net/pexpect.html
>>> See
On May 28, 5:31 am, Sebastian Wiesner wrote:
>
>
> > Your best bet is to make sudo not ask for a password. :) If you
> > don't have the rights, then you can use pexpect to do what you want to
> > do. http://pexpect.sourceforge.net/pexpect.html
>
> > See the second example on that page.
>
> > c
> Your best bet is to make sudo not ask for a password. :) If you
> don't have the rights, then you can use pexpect to do what you want to
> do. http://pexpect.sourceforge.net/pexpect.html
>
> See the second example on that page.
>
> child = pexpect.spawn('scp foo myn...@host.example.com:.')
On Thu, May 28, 2009 at 9:11 AM, Sean DiZazzo wrote:
> On May 27, 6:10 pm, thebiggestbangthe...@gmail.com wrote:
> > hello everyone :-),
> > I am a newbie to python. I am trying to run a
> > bash script from within a python program. I would greatly appreciate
> > any point
On May 27, 6:10 pm, thebiggestbangthe...@gmail.com wrote:
> hello everyone :-),
> I am a newbie to python. I am trying to run a
> bash script from within a python program. I would greatly appreciate
> any pointers/comments about how to get around the problem I am facing.
>
hello everyone :-),
I am a newbie to python. I am trying to run a
bash script from within a python program. I would greatly appreciate
any pointers/comments about how to get around the problem I am facing.
I want to run bash script: code.sh from within a python program.
c
On Jan 8, 1:20 am, Robert Latest <[EMAIL PROTECTED]> wrote:
> Hello,
>
> look at this function:
>
> --
> def test():
> child = os.popen('./slow')
> for line in child:
> print line
> -
>
> The program "slow" just writes the numbers 0 through 9 on stdout, one l
Robert Latest <[EMAIL PROTECTED]> writes:
>> If you see lines one by one, you are in luck, and you can fix things
>> on the Python level simply by avoiding buffering in popen. If not,
>> you will need to resort to more advanced hackery (e.g. fixing stdio
>> using LD_PRELOAD).
>
> Do I really? Aft
pexpect is the solution. Seems to wrap quite a bit of dirty pseudo-tty
hacking.
robert
--
http://mail.python.org/mailman/listinfo/python-list
Hrvoje Niksic wrote:
> stdio uses different buffering strategies depending on the output
> type. When the output is a TTY, line buffering is used; when the
> output goes to a pipe or file, it is fully buffered.
Makes sense.
> If you see lines one by one, you are in luck, and you can fix things
Robert Latest <[EMAIL PROTECTED]> writes:
> If 'slow' or some other program does buffered output, how come I can
> see its output line-by-line in the shell?
stdio uses different buffering strategies depending on the output
type. When the output is a TTY, line buffering is used; when the
output g
Marc 'BlackJack' Rintsch wrote:
> Both processes have to make their communication ends unbuffered or line
> buffered.
Yeah, I figured something like that.
> And do whatever is needed to output the numbers from ``slow``
> unbuffered or line buffered.
Hm, "slow" of course is just a little test pr
On Tue, 08 Jan 2008 09:20:16 +, Robert Latest wrote:
> The program "slow" just writes the numbers 0 through 9 on stdout, one line a
> second, and then quits.
>
> I would have expected the python program to spit out a numbers one by one,
> instead I see nothing for 10 seconds and then the wh
Hello,
look at this function:
--
def test():
child = os.popen('./slow')
for line in child:
print line
-
The program "slow" just writes the numbers 0 through 9 on stdout, one line a
second, and then quits.
I would have expected the python program to spit
dude wrote:
> Working on Windows XP
> Say I have a Windows executable, foo.exe.
> foo.exe is a command line tool that can take a number of different
> arguments and perform corresponding actions.
>
> I want to invoke foo.exe from a Python script (using whatever will
> work best). I want to contin
Working on Windows XP
Say I have a Windows executable, foo.exe.
foo.exe is a command line tool that can take a number of different
arguments and perform corresponding actions.
I want to invoke foo.exe from a Python script (using whatever will
work best). I want to continuously pass arguments to f
36 matches
Mail list logo