Re: Run a external program.

2009-11-14 Thread MRAB
Yasser Almeida Hernández wrote: Hi all!! I'm writing a script where i call a external program which receive some arguments. One of this arguments is stored in a variable, that is passed as argument as well: import os ... f = open(file1, 'r') s = 'command $f -i file2 -w 1.4 -o file3.out'

Re: Run a external program.

2009-11-14 Thread Mark Tolonen
Yasser Almeida Hernández pedro...@fenhi.uh.cu wrote in message news:20091114142611.sj45qput2c84s...@correo.fenhi.uh.cu... Hi all!! I'm writing a script where i call a external program which receive some arguments. One of this arguments is stored in a variable, that is passed as argument

Re: Run a external program.

2009-11-14 Thread Yasser Almeida Hernández
So, how can i pass an argument as a variable in this context...? Quoting MRAB pyt...@mrabarnett.plus.com: Yasser Almeida Hernández wrote: Hi all!! I'm writing a script where i call a external program which receive some arguments. One of this arguments is stored in a variable, that is

Re: Run a external program.

2009-11-14 Thread Chris Rebert
Quoting MRAB pyt...@mrabarnett.plus.com: Yasser Almeida Hernández wrote: Hi all!! I'm writing a script where i call a external program which receive  some arguments. One of this arguments is stored in a variable, that is passed as  argument as well: import os ... f = open(file1, 'r')

Re: Run a external program.

2009-11-14 Thread MRAB
Yasser Almeida Hernández wrote: So, how can i pass an argument as a variable in this context...? You can't pass arbitrary values on a command line. In this case, why not just pass the path of the file? s = 'command %s -i file2 -w 1.4 -o file3.out' % file1 Quoting MRAB

Re: Run a external program.

2009-11-14 Thread Yasser Almeida Hernández
All ran ok!! Thanks a lot Quoting MRAB pyt...@mrabarnett.plus.com: Yasser Almeida Hernández wrote: So, how can i pass an argument as a variable in this context...? You can't pass arbitrary values on a command line. In this case, why not just pass the path of the file? s = 'command %s -i

Re: Run a external program.

2009-11-14 Thread Terry Reedy
Top-posting makes things more confusing. You cannot pass a Python file object to an external process. Pass the name instead. Yasser Almeida Hernández wrote: So, how can i pass an argument as a variable in this context...? Quoting MRAB pyt...@mrabarnett.plus.com: Yasser Almeida Hernández