[Tutor] Runnig a windows.exe from python

Steven D'Aprano steve at pearwood.info
Wed Sep 29 22:37:00 CEST 2010


On Thu, 30 Sep 2010 05:49:53 am Susana Iraiis Delgado Rodriguez wrote:
> Hello everyone:
>
> 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?

Please don't add extra "bits" around the code you use -- there's no need 
to add asterisks * around the code. Just copy and paste it it into the 
email.

Can you please copy and paste the exact error message you get? Include 
the full traceback, not just the last line.

Also, it is a little-known thing that Windows accepts forward slashes as 
well as back-slashes in pathnames. So it is easier to write:

"C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr.exe" 

than:

"C:\\Archivos de programa\\FWTools2.4.7\\bin\\ogr2ogr.exe" 



-- 
Steven D'Aprano


More information about the Tutor mailing list