[gdal-dev] Fwd: NotImplementedError: Wrong number of arguments
for overloaded function 'Feature_SetField'.
Ole Nielsen
ole.moller.nielsen at gmail.com
Sat Sep 3 23:54:34 EDT 2011
Hi again and sorry for nagging, but do you have any hints as to what this
error means
> 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)
The input to the Python bindings is of the form
SetField('STRUCT_DAMAGE_fraction', 0.346734256639)
i.e. one string argument (char*) followed by a float (double) which I
thought would be matched by the third last header above. It works fine on
version 1.6 but not version 1.8.
Can anyone tell me what has changed, what it means and how to work around it
- please?
Many thanks
Ole
On Thu, Sep 1, 2011 at 7:33 PM, Even Rouault
<even.rouault at mines-paris.org>wrote:
> 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
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110904/c0f43ddb/attachment.html
More information about the gdal-dev
mailing list