I am using GDAL to convert a .tif to .shp file.

gdal_polygonize.py input.tif -f “ESRI Shapefile” out.shp

However this does not work and results in:

Traceback (most recent call last):
  File "/usr/local/bin/gdal_polygonize.py", line 166, in <module>
    drv = ogr.GetDriverByName(format)
  File "/Library/Frameworks/GDAL.framework/Versions/1.11/Python/2.7/site-packages/osgeo/ogr.py", line 5255, in GetDriverByName
    return _ogr.GetDriverByName(*args)
TypeError: in method 'GetDriverByName', argument 1 of type 'char const *

I don't believe there is anything wrong with the .tif file or the command

  • 3
    Are you still having this problem? I ask this because you asked this question a few minutes later which suggests that you got the gdal_polygonize.py tool working :)
    – Joseph
    May 12, 2016 at 13:21
  • 3
    I wondered if someone would notice! Two different computers ;) I can't get it functioning on a more powerful computer. May 12, 2016 at 13:23
  • 1
    Are you using the same python version on both computers? Does the Python version match the version that GDAL was compiled/packaged for? May 12, 2016 at 17:17

1 Answer 1


If this is Python 3, I have just come across this problem, and it seems to be that gdal cannot handle unicode strings as input arguments.

It's a bit messy, but try

drv = ogr.GetDriverByName(str(format))

I am currently looking for a better solution.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .