Hi

On 22/01/2023 14:42, gisfi...@t-online.de wrote:

Hello list,

I have problems with v.in.ogr in a python script; I use:

/grass.run_command('v.in.ogr',input='d:/my_input',output='my_output',type='boundary,centroid',where='LENGTH != 1',snap=0.01,min_area=0.01,flags="o",overwrite=True)/

This has been working fine for years in GRASS 7.0.3 with Python 2.

Now, I tried in GRASS 7.8 on Python 3 and I get the following error:

ERROR 1: "LENGTH" not recognised as an available field.

FEHLER: Error setting attribute filter 'LENGTH != 1'

The field called LENGTH is present and there is no typing error. What I absolutely not understand is that the command is working fine inside GRASS itself! Just the Python script does not.


Can you try to create the where clause with double quotes before calling grass.run_command? Like so:


expr = '"LENGTH != 1"'

grass.run_command('v.in.ogr', input='...', output='...', where=expr, type='...', .....)


„LENGTH“ is not a Python reserved keyword, and no SQL reserved keyword. I also tried it with another name for that column. That also did not work.

Any ideas what could be wrong? Thank you very much.

Uwe


_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to