[Tutor] EXECUTING PYTHON AND SQL STAMENTS

Steve Willoughby steve at alchemy.com
Mon Oct 4 16:42:20 CEST 2010


On 04-Oct-10 07:32, Norman Khine wrote:
> On Mon, Oct 4, 2010 at 4:04 PM, Susana Iraiis Delgado Rodriguez
> <susana.delgado_s at utzmg.edu.mx>  wrote:
>>        os.system('"C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr.exe"'+" "
>> +"arg1" +" "+ "-where" +" "+ "arg2" +" " +"arg3")

You're including the text "arg1" in the command, not the value of the 
arg1 variable.  (Likewise for arg2 and arg3).  There are some 
unnecessary extra strings in there too.  Your os.system() call, slightly 
simplified, is:

os.system('"C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr.exe 
"+"arg1" +" -where "+"arg2" +" " +"arg3")

but what I think you meant was

os.system('"C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr.exe "+arg1 
+" -where "+arg2 +" " +arg3)

There are even better ways to accomplish this task too, but I'm focusing 
on what looks like you ran into with this first.


More information about the Tutor mailing list