[gdal-dev] Fwd: NotImplementedError: Wrong number of arguments for overloaded function 'Feature_SetField'.

Even Rouault even.rouault at mines-paris.org
Thu Sep 1 08:33:13 EDT 2011


Selon Ole Nielsen <ole.moller.nielsen at gmail.com>:

> Sorry for the addition, but regarding the issue with SetField, I just had
> the same error with the inputs
> SetField('STRUCT_DAMAGE_fraction', 0.346734256639)
>
> To repeat, this works on every standard Ubuntu installation I have used
> (10.04, 10.10, 11.04). However, after installing qgis 1.7 on Ubuntu 11.04
> this error keeps happening in our code. I don't know how to find out what
> version of org we are using.

My feeling is that there must be something broken in your installation. This
should work. Check that both your gdal lib and gdal python packages are updated
at the same version. dpkg -l|grep gdal should give you some hints.

>
> Please let me know how to work around this or if there is a patch you can
> apply.
>
> Cheers and thanks
> Ole
>
>
>
> ---------- Forwarded message ----------
> From: Ole Nielsen <ole.moller.nielsen at gmail.com>
> Date: Thu, Sep 1, 2011 at 4:04 PM
> Subject: NotImplementedError: Wrong number of arguments for overloaded
> function 'Feature_SetField'.
> To: gdal-dev at lists.osgeo.org
> Cc: Ariel Nunez <ingenieroariel at gmail.com>, Ted Dunstone <ted at biometix.com>
>
>
> Developing on a code which relies on ogr.py and that has been running for a
> while on Ubuntu 10.04, 10.10 and 11.04 I saw for the first time today the
> error
>
> ....
> ERROR 1: No such field: 'CONTENTS_DAMAGE_fraction'
> ERROR 1: No such field: 'STRUCT_INUNDATED'
> ERROR 1: No such field: 'STRUCT_LOSS_AUD'
> ERROR 1: No such field: 'CONTENTS_LOSS_AUD'
> ERROR 1: No such field: 'PEOPLE_AFFECTED'
> .....
>   File "/home/nielso/dev/riab/impact/storage/vector.py", line 426, in
> write_to_file
>     feature.SetField(name, data[i][name])
>   File "/usr/lib/python2.7/dist-packages/osgeo/ogr.py", line 2184, in
> SetField
>     return _ogr.Feature_SetField(self, *args)
> NotImplementedError: Wrong number of arguments for overloaded function
> 'Feature_SetField'.
>   Possible C/C++ prototypes are:
>     SetField(OGRFeatureShadow *,int,char const *)
>     SetField(OGRFeatureShadow *,char const *,char const *)
>     SetField(OGRFeatureShadow *,int,int)
>     SetField(OGRFeatureShadow *,char const *,int)
>     SetField(OGRFeatureShadow *,int,double)
>     SetField(OGRFeatureShadow *,char const *,double)
>     SetField(OGRFeatureShadow *,int,int,int,int,int,int,int,int)
>     SetField(OGRFeatureShadow *,char const *,int,int,int,int,int,int,int)
>
>
>
> This happened after I (as an unrelated act) installed qgis 1.7 so I am
> guessing GDAL got upgraded as well.
> The arguments to SetField in this case are: SetField('MMI', nan)
> Types are
> 'MMI' <type 'str'>
> nan <type 'float'>
>
> So does this mean that nan used to be supported and no longer is?
> Or is it me doing something wrong.
>
>
>
> I have seen references to this issue at
>
>
http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Proposed-UTF-8-SWIG-Changes-td5575272.html
> http://lists.osgeo.org/pipermail/gdal-dev/2010-September/026156.html
>
> but they seem to be more concerned with defining typemaps in the C
> libraries. What I need to know is how to modify my
> Python code so that this runs again on all relevant gdal versions.
>
> Can anyone help, please?
>
> Many thanks
> Ole Nielsen
>




More information about the gdal-dev mailing list