Vivian Tini wrote:
> Dear All,
>
> I am a newbie in Python and I would like to create command line interface for
> executing different softwares, either local or remotely.
>
> I begin with a very simple case in which I have an executable file called
> "TestCases" and this file requires Des.in as an the input. Both files are
> located in the same local folder.
>
> The TestCases executable works properly when I run it from the shell prompt.
>
> Then I try to run it from the Python command prompt by the following script:
>>>> import os
>>>> os.system("home/.../.../.../TestCases")
>
> I used "..." to type it short.
>
> Then it gives the following error output:
> cannot open Des.in
>
> Well in this case tbe os.system command is typed correctly already since this
> the error message given out is written in the code itself. So the executable
> run already only when running from Python prompt it cannot open this file.
>
> Could anyone suggest me what would be the cause of this problem? And how
> should I handle it ?
I guess the working directory is not set to the dir containing TestCases
so it doesn't find the file.
I don't know if it will help to call os.chdir() before os.system(); you
could use subprocess.Popen() instead of os.system(), it takes an
explicit parameter of the cwd for the subprocess.
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor