[Tutor] about calling external program in Python
Mu Mu
mumufitt at gmail.com
Wed May 17 21:09:35 CEST 2006
I redid the following:
import os
import sys
sys.path.append('C:\Program Files\EPANET2')
os.system('epanet2d.exe C:\simulation_test\Network3_1.inp
C:\simulation_test\Network3_1.out')
and safed this as test.py
In the Pythonwin interface to run. I got nothing.
Then I added 'C:\Program Files\EPANET2' into the system path.
In the cmd line: I typed python c:\test.py. It ran and then gave the output.
Don' t know why command line works. but pythonwin interface failed .
Thanks.
J.
On 5/17/06, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
> "Mu Mu" <mumufitt at gmail.com> wrote in message
> news:2b9562040605171021k42b5b2c8v60d4952129d1240e at mail.gmail.com...
> > I tried the following:
> > >>> os.system(r'C:\\simulation test\\epanet2d.exe C:\\simulation
> > test\\Network3_1.inp C:\\simulation test\\Network3_1.out')
> > 1
>
> Any non zero return value means that an error occurred.
> The os.system call worked and the OS returned an error, which
> usually means you got a path wrong or the user running puython
> doesn't have access rights to the executable.
>
> > They all returned '1' in the interactive window and gave no result
> > in the
> > designated output folder. All I saw is a flash of the ms-dos black
> > window
> > and then disappeared.
> >
> > I tried ms-dos command line, it works pretty good.
>
> What happens if you try it from the Start->Run dialog?
> The CMD box may have some environment settings that are missing
> when Python runs.
>
> Alan G.
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060517/f158bb47/attachment.html
More information about the Tutor
mailing list