"Susana Iraiis Delgado Rodriguez" <susana.delgad...@utzmg.edu.mx> wrote

I'm working in a simple python module to run a external command, this
command is named "ogr2ogr.exe" . When I execute my python script :

*import os
def call():
os.system(' "C:\\Archivos de programa\\FWTools2.4.7\\bin\\ogr2ogr.exe"
')*
*     raw_input()*
*call()*
It runs, but if I want to enter arguments: *ogr2ogr* to test my .exe, it
shows me an error *"ogr2ogr is not define", *any suggestion?

You need to read the arfguments before calling the exe. Then create the full
command string and pass that tro os.system.

However os.system is a blunt instrument, you will find you have much more
control using the subprocess module which supercedes os.system and
various others ways of executing external programs. It take a wee bit
more effort but the extra control is worth it.

The documentation  has numerous examples and the "Using the OS"
topic of my tutorial has some info too.

HTH

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to