Susana Iraiis Delgado Rodriguez susana.delgado_s at utzmg.edu.mx
Tue Oct 5 17:57:03 CEST 2010

Hello, I already solved the problem, I change all the code, instead of using
os.system I changed to subprocess.Popen() and it worked fine:

import shlex, subprocess
def process():
     print "Ingresa en el siguiente orden:"
     print "Nombre del nuevo mapa.shp Nombre de la capa Nombre del mapa
     command_line = raw_input()
     args = shlex.split(command_line)
     p = subprocess.Popen(['C:/Archivos de
programa/FWTools2.4.7/bin/ogr2ogr', args[0], '-where', args[1], args[2]])
 if p:
  print "Mapa generado"

Now the user has to enter 3 arguments an finally it worked. I have a
question, how can I tell the user if p execute ok? because even thouhg I
entered wrong parameters, it prints "Mapa generado". This line should only
appears if the arguments are acceptable.

2010/10/5 Susana Iraiis Delgado Rodriguez <susana.delgado_s at utzmg.edu.mx>

> Hello Norman:
> Thank you for taking the time to answer. I already changed my os.system()
> for your code. I got an error, when I executed this:
>  os.system(" 'C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr.exe '
> "+arg1 +" -where "+arg2 +" " +arg3)
> it throws me that "C:/Archivos"  is not recognized as an executable
> external or internal command, programm or file.
> If you really have other opton to fix my problem I'll be thankful because I
> don't have any idea to make this code useful.
> Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101005/c18f412b/attachment.html>

More information about the Tutor mailing list