i'm trying to execute gdal_polygoinize.py command. I have a main python method that takes in input a raster file and a output shapefile, and then calls a method named polygonize.py that builds and try to execute the gdal_polygonize command.
The code is:
format = "ESRI Shapefile"
command_poligonize = "gdal_polygonize.bat " + \
+ input_raster + ' '\
'-f ' + '"' + format + '"'+ \
shape_output
status=subprocess.call(command_poligonize, shell=True)
i tryed also with the os.system() method:
os.system(command_poligonize)
Executing the command:
print('DEBUG: comand: ' + command_poligonize)
i obtain the correct gdal_polygonize invocation, like:
gdal_polygonize.py input.tif -f "ESRI Shapefile" output.shp
The error description is the following:
File "C:\OSGeo4W64\bin\gdal_polygonize.py", line 209, in <module>
callback = prog_func )
File "C:\Python35\lib\site-packages\osgeo\gdal.py", line 1636, in Polygonize
return _gdal.Polygonize(*args, **kwargs)
RuntimeError: Object given is not a Python function
Any suggestion?
I tryed to run the command by itself, like:
gdal_polygonize.py input.tif -f "ESRI Shapefile" output.shp
and it return with the following error:
File "C:\OSGeo4W64\bin\gdal_polygonize.py", line 209, in <module>
callback = prog_func )
File "C:\Python35\lib\site-packages\osgeo\gdal.py", line 1636, in Polygonize
return _gdal.Polygonize(*args, **kwargs)
RuntimeError: Object given is not a Python function
I'm using Python35 and Gdal 2.0.2 released 2016/01/26.