Re: [Tutor] execute an OS command, get the output

2006-03-12 Thread w chun
yup, that's right. turns out that it doesn't really matter whether the cmd is run in a shell or not -- that's one of the great things about subprocess -- you get to choose. with os.system(), *everything* is run through the shell. apparently, this problem isn't new... the problem is that the othe

Re: [Tutor] *args consumption

2006-03-12 Thread Anna Ravenscroft
On 3/12/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Danny has given some reasons why this is not useful standard behaviour.If this is a behaviour you need for many functions, you could create adecorator that provides it so you don't have to include the same boilerplate in each function.Decorators a

Re: [Tutor] *args consumption

2006-03-12 Thread Kent Johnson
Smith wrote: > But there is another use that I am looking at right now (as encountered in the turtle module) where the arguments are analyzed in the function and not passed along. In such cases it seems like the first two lines of the function below are needed to get the passed arg out of the tuple

Re: [Tutor] execute an OS command, get the output

2006-03-12 Thread Alan Gauld
Wes, I haven't tried this but I notice you don't specify shell=True in your Popen calls, that might be the cause - ypou aren't acting like the shell does. But aws I say thats just a guess based on a quick scim of your port. Alan G. - Original Message - From: "w chun" <[EMAIL PROTECTED

Re: [Tutor] i have a question

2006-03-12 Thread Andrei
Tom Bachik gmail.com> writes: > ok say u want python to ask the user to type a username then password for a game account thats easy but how do u get the information they typed back to you? Depends on the environment you're asking it in. If it's command-line, you're probably using the raw_input f

Re: [Tutor] *args consumption

2006-03-12 Thread Smith
Danny Yoo wrote: || Am I missing some other usage where you wouldn't want to unpack the || *arg? If not, would the following "behind the scenes" behavior be || possible/preferred? || || ### || def foo(*arg): || pass || ### || || automatically does this || || ### || def foo(*arg): || if l

Re: [Tutor] execute an OS command, get the output

2006-03-12 Thread Alan Gauld
> Just for the heack of it, I wrote a tiny Python echo program, and > interposed it in the pipe between the strings and grep command: > > while 1: > line = raw_input() > print line > > The command line now looks like this: > >> strings 3193.DAT | python echo.py | grep Newsgroups: |

Re: [Tutor] execute an OS command, get the output

2006-03-12 Thread Alan Gauld
> I gotta admit, this took me by surprise, too, but my guess is that once > the head command is done, it closes the pipe it's reading from, which is > being filled by grep; grep takes the hint and terminates, closing the pipe > it's reading from, which is being filled by strings; and strings takes

Re: [Tutor] need help tracing a syntax error

2006-03-12 Thread Alan Gauld
> There was no actual message. The syntax error message to me > occurred in a dialog box which closed immediately. What development tool are you using? I would change it, if it doesn't display a full error trace then it is depriving you of one of the most useful tools in Python! > It's not