[GRASS-dev] pygrass v.import_() strange error

Vaclav Petras wenzeslaus at gmail.com
Wed Jul 25 04:20:59 PDT 2018


On Wed, Jul 25, 2018, 3:34 AM Yann Chemin <dr.yann.chemin at gmail.com> wrote:

> Hi,
> (script below)
> I get this error
>
> v.import_(input=adminfile,output="admin",quiet=True,superquiet=True)
>   File "/usr/lib/grass74/etc/python/grass/pygrass/modules/shortcuts.py",
> line 47, in __getattr__
>     return self.cls('%s.%s' % (self.prefix, name.replace('_', '.')))
>   File
> "/usr/lib/grass74/etc/python/grass/pygrass/modules/interface/module.py",
> line 530, in __init__
>     raise GrassError(str_err % self.name)
> grass.exceptions.GrassError: Error running: `v.import.
> --interface-description`.
>

It seems that PyGRASS does not support the "underscore at the end when
Python keyword". It just does it's usual thing which is replacing
underscores with dots like in r.slope_aspect. So probably a new
functionality needs to be added to replace import_ with just import.
Something like name.strip('_'). Please add a test for it.

Best,
Vaclav




> #SCRIPT
> from grass_session import Session
> from grass.pygrass.modules.shortcuts import vector as v
> adminfile=gadm_FR_2_Morbihan.gpkg
> with Session(gisdb="/tmp", location="loc", create_opts="EPSG:4326"):
>      v.import_(input=adminfile,output="admin",quiet=True,superquiet=True)
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180725/44430443/attachment-0001.html>


More information about the grass-dev mailing list