[gdal-dev] python script not working

Sean Gillies sean at mapbox.com
Thu Jan 16 08:57:45 PST 2014


You either have to know the absolute path to gdal_polygonize.py or have 
its location on your system path to make that work. And I also recommend
the subprocess module instead of the deprecated os.system.

     import subprocess

          '-f KML',

The gdal_polygonize.py script is a very thin wrapper around the 
gdal.Polygonize() function. Shelling out from a Python script to another 
Python script is kind of round-a-bout – you could just grab the 
gdal_polygonize.py code and reuse it in your Python program.

On 1/16/14, 9:53 AM, Dennis Burgess wrote:
> Runing a command to do a gdal_polygonize, the gdal_translate and org2org
> functions work just ifne, just not poloygoize..??
> os.system('gdal_polygonize tmp.4.vrt -f KML tmp.5.kml')
> I get :
> python: can't open file '\bin\gdal_polygonize.py';: error 2, no such
> file or directory
> any thoughts, windows gdal using osgeo4w
> *_Dennis Burgess,_**//*

Sean Gillies
sean at mapbox.com

More information about the gdal-dev mailing list