[gdal-dev] TypeError: in method 'Dataset_GetRasterBand', argument 2 of type 'int'

Vincent Schut schut at sarvision.nl
Fri Jun 12 03:26:32 EDT 2009


Folks,

since some days (I have upgraded both gdal (refreshed from trunk) and 
numpy (trunk), and maybe even swig) I get swig related errors from the 
python gdal bindings when passing an element from a numpy array to a 
gdalpython function that expects an int, like:

TypeError: in method 'Dataset_GetRasterBand', argument 2 of type 'int'

the type that is being passed here is <type 'numpy.int64'>. So indeed 
this is no true pythonic int, rather a numpy type, though it can be 
regarded as an integer. Now I know this used to work before, I just 
don't know what changed where to make it not work. Gdal? Numpy? Swig?
It's easy to circumvent by adding a int(...) where necessary, but it's 
rather inconvenient.

I decided to first try the gdal ml. If it's not gdal's fault, I'll try 
the numpy folks ofcourse.

Vincent.


More information about the gdal-dev mailing list