Re: pipes like perl

2005-08-25 Thread Piet van Oostrum
> "infidel" <[EMAIL PROTECTED]> (i) wrote: >i> .readlines() won't return until it hits end-of-file, but the "man" >i> command waits for user input to scroll the content, like the "more" or >i> "less" commands let you view "pages" of information on a terminal. man shouldn't wait for user input

Re: pipes like perl

2005-08-25 Thread max(01)*
many thanks to all the fellows who cared to answer! bye max -- http://mail.python.org/mailman/listinfo/python-list

Re: pipes like perl

2005-08-24 Thread infidel
> but... i see it doesn't work for some commands, like "man python" (it > gets stuck on the "if" line)... .readlines() won't return until it hits end-of-file, but the "man" command waits for user input to scroll the content, like the "more" or "less" commands let you view "pages" of information on

Re: pipes like perl

2005-08-24 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "max(01)*" <[EMAIL PROTECTED]> wrote: > in perl i can do this: ... > but i do not know how to do it in python, because "if *command*:" gives > syntax error. > > moreover, if i use ... > it doesn't work, since "*do_something*" and *do_something_more* are > always

Re: pipes like perl

2005-08-24 Thread Sybren Stuvel
max(01)* enlightened us with: > but i need to check the success/failure of the external command > *before* closing the file! You can't, unless you have a more intimite knowledge of the command involved. If you know, for instance, that any output on stderr means an error, you can check for just tha

Re: pipes like perl

2005-08-23 Thread max(01)*
max(01)* wrote: > infidel wrote: > >> Here's one technique I use to run an external command in a particular >> module: >> >> stdin, stdout, stderr = os.popen3(cmd) >> stdin.close() >> results = stdout.readlines() >> stdout.close() >> errors = stderr.readline

Re: pipes like perl

2005-08-23 Thread max(01)*
infidel wrote: > Here's one technique I use to run an external command in a particular > module: > > stdin, stdout, stderr = os.popen3(cmd) > stdin.close() > results = stdout.readlines() > stdout.close() > errors = stderr.readlines() > stderr.close()

Re: pipes like perl

2005-08-23 Thread max(01)*
bruno modulix wrote: > max(01)* wrote: > >>hi. > > > (snip) > > >>it doesn't work, since "*do_something*" and *do_something_more* are >>always executed (it seems like >> >>MYPIPE = os.popen("*some_system_command*", "r") >> >>does not raise any exception even if *some_system_command* does not >

Re: pipes like perl

2005-08-23 Thread infidel
Here's one technique I use to run an external command in a particular module: stdin, stdout, stderr = os.popen3(cmd) stdin.close() results = stdout.readlines() stdout.close() errors = stderr.readlines() stderr.close() if errors: r

Re: pipes like perl

2005-08-23 Thread bruno modulix
max(01)* wrote: > hi. (snip) > it doesn't work, since "*do_something*" and *do_something_more* are > always executed (it seems like > > MYPIPE = os.popen("*some_system_command*", "r") > > does not raise any exception even if *some_system_command* does not > exist/work... > > any help? http://

pipes like perl

2005-08-23 Thread max(01)*
hi. in perl i can do this: ... if (open (MYPIPE, "*some_system_command* |")) { ... *do_something* ... while ($answer = ) { print $answer; } ... *do_something_more* ... } else { ... *do_something_else* ... } ...