[GRASS-dev] "Parameter <layer>, require: string" in v.db.dropcolumn

Hi all!

Using "v.db.dropcolumn" within from latest "grass_trunk",

I wonder why the "layer" parameter in "v.db.dropcolumn" is required to be a
string as stated in an error message while trying to run a py-grass script:

--%<---
File "/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python/grass/pygrass/modules/__init__.py", line 466, in __call__
    self.inputs[key].value = val

  File "/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python/grass/pygrass/modules/__init__.py", line 182, in _set_value
    raise TypeError(str_err % (self.name, self.typedesc, type(value)))

TypeError: The Parameter <layer>, require: string, get: <type 'int'> instead
-->%---

Shouldn't the "layer" parameter be simply an integer?

Thanks, Nikos

On 19/11/12 11:42, Nikos Alexandris wrote:

Hi all!

Using "v.db.dropcolumn" within from latest "grass_trunk",

I wonder why the "layer" parameter in "v.db.dropcolumn" is required to be a
string as stated in an error message while trying to run a py-grass script:

--%<---
File "/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python/grass/pygrass/modules/__init__.py", line 466, in __call__
     self.inputs[key].value = val

   File "/geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python/grass/pygrass/modules/__init__.py", line 182, in _set_value
     raise TypeError(str_err % (self.name, self.typedesc, type(value)))

TypeError: The Parameter<layer>, require: string, get:<type 'int'> instead
-->%---

Shouldn't the "layer" parameter be simply an integer?

In GRASS7 you can name layers, which is used particularly for the direct OGR access. As the man page for v.db.dropcolumn says:

"layer=string [required]
     Layer number or name
     A single vector map can be connected to multiple database tables.
     This number determines which table to use. When used with direct
     OGR access this is the layer name."

Moritz

Hi,

2012/11/21 Moritz Lennert <mlennert@club.worldonline.be>:

In GRASS7 you can name layers, which is used particularly for the direct OGR
access. As the man page for v.db.dropcolumn says:

also GRASS vector layers is possible to access by names. By it's not
really used and probably also not fully supported. Most of modules are
probablty casting layer to integer. See [1].

Martin

[1] http://grass.osgeo.org/programming7/field_8c.html#acdcddf923a4eb58aafdba8198fe280cd

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa