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
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
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
19 matches
Mail list logo