[Tutor] about calling external program in Python

Mu Mu mumufitt at gmail.com
Wed May 17 19:21:24 CEST 2006


Dear all,

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
>>> os.system('C:\simulation test\epanet2d.exe C:\simulation
test\Network3_1.inp C:\simulation test\Network3_1.out')
1
>>> os.system(r'C:\simulation test\epanet2d.exe C:\simulation
test\Network3_1.inp C:\simulation test\Network3_1.out')
1
>>> os.system(r'"C:\simulation test\epanet2d.exe"  "C:\simulation
test\Network3_1.inp" "C:\simulation test\Network3_1.out"')
1

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.

Thanks.
J.




On 5/17/06, w chun <wescpy at gmail.com> wrote:
>
> > I'm trying to call an executable program in Python. I did the following,
> but
> > it doesn't work. Any help is appreciated.
> >
> > os.system('C:\Program Files\EPANET2\epanet2d.exe
> > C:\simulation test\Network3_1.inp  C:\simulationtest\Network3_1.out')
>
>
> try putting an "r" in front of the string, i.e. os.system(r'C:.....).
>
> you mentioned "it doesn't work."  what do you mean by that?  in other
> words, what did the Python interpreter do...  give an error, nothing,
> etc.?
>
> thanks,
> -wesley
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> "Core Python Programming", Prentice Hall, (c)2007,2001
>    http://corepython.com
>
> wesley.j.chun :: wescpy-at-gmail.com
> python training and technical consulting
> cyberweb.consulting : silicon valley, ca
> http://cyberwebconsulting.com
> _______________________________________________
> 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/509897b9/attachment.htm 


More information about the Tutor mailing list