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' os.system(s) ...
When i run the script i get the next message... '-i: No such file or directory' ... with a obvious error in the exit of the program. If i remove the option -i i get the same error with every option, even with those who don't get any file as argument. (file2 exist). BUT, when i run the external program in a python shell, it works...
What's wrong?
Please help me... Thanks
-- Lic. Yasser Almeida Hernández Center of Molecular Inmunology (CIM) Nanobiology Group P.O.Box 16040, Havana, Cuba Phone: (537) 271-7933, ext. 221
> 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' > os.system(s) > ...
> When i run the script i get the next message... > '-i: No such file or directory' > ... with a obvious error in the exit of the program. If i remove the > option -i i get the same error with every option, even with those who > don't get any file as argument. (file2 exist). > BUT, when i run the external program in a python shell, it works...
> What's wrong?
The name 'f' in the Python script exists only in Python and is unrelated to the '$f' that the shell sees.
> 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' > os.system(s) > ...
> When i run the script i get the next message... > '-i: No such file or directory' > ... with a obvious error in the exit of the program. If i remove the > option -i i get the same error with every option, even with those who > don't get any file as argument. (file2 exist). > BUT, when i run the external program in a python shell, it works...
> What's wrong?
Please post a small, complete example of your code and the error message. Cut-and-paste them exactly. Also provide the shell command you are running that works.
>> 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' >> os.system(s) >> ...
>> When i run the script i get the next message... >> '-i: No such file or directory' >> ... with a obvious error in the exit of the program. If i remove >> the option -i i get the same error with every option, even with >> those who don't get any file as argument. (file2 exist). >> BUT, when i run the external program in a python shell, it works...
>>> 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' >>> os.system(s) >>> ...
>>> When i run the script i get the next message... >>> '-i: No such file or directory' >>> ... with a obvious error in the exit of the program. If i remove the >>> option -i i get the same error with every option, even with those who don't >>> get any file as argument. (file2 exist). >>> BUT, when i run the external program in a python shell, it works...
>>> What's wrong?
>> The name 'f' in the Python script exists only in Python and is unrelated >> to the '$f' that the shell sees.
>>> 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' >>> os.system(s) >>> ...
>>> When i run the script i get the next message... >>> '-i: No such file or directory' >>> ... with a obvious error in the exit of the program. If i remove the >>> option -i i get the same error with every option, even with those >>> who don't get any file as argument. (file2 exist). >>> BUT, when i run the external program in a python shell, it works...
>>> What's wrong?
>> The name 'f' in the Python script exists only in Python and is unrelated >> to the '$f' that the shell sees.
>>>> 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' >>>> os.system(s) >>>> ...
>>>> When i run the script i get the next message... >>>> '-i: No such file or directory' >>>> ... with a obvious error in the exit of the program. If i remove >>>> the option -i i get the same error with every option, even with >>>> those who don't get any file as argument. (file2 exist). >>>> BUT, when i run the external program in a python shell, it works...
>>>> What's wrong?
>>> The name 'f' in the Python script exists only in Python and is unrelated >>> to the '$f' that the shell sees.
>>> 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' >>> os.system(s) >>> ...
>>> When i run the script i get the next message... >>> '-i: No such file or directory' >>> ... with a obvious error in the exit of the program. If i remove the >>> option -i i get the same error with every option, even with those >>> who don't get any file as argument. (file2 exist). >>> BUT, when i run the external program in a python shell, it works...