[GRASS-dev] [GRASS GIS] #3490: pygrass: improve error messages for table handling
GRASS GIS
trac at osgeo.org
Tue Feb 6 01:30:30 PST 2018
#3490: pygrass: improve error messages for table handling
-----------------------------------+-------------------------
Reporter: sbl | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone:
Component: Python | Version: unspecified
Keywords: pygrass,vector,SQLite | CPU: All
Platform: All |
-----------------------------------+-------------------------
When I try to create a new vector map in pygrass where columns in the
attribute table (SQLite) contain "." (e.g. "landsatIm.5")
new.open() fails saying first that table exisits and then that it does not
exist:
{{{
Traceback (most recent call last):
File
"/home/NINA.NO/stefan.blumentrath/.grass7/addons/scripts/i.pysptools.unmix",
line 329, in <module>
sys.exit(main())
File
"/home/NINA.NO/stefan.blumentrath/.grass7/addons/scripts/i.pysptools.unmix",
line 272, in main
new.open('w', tab_name=endmembers, tab_cols=cols)
File
"/home/NINA.NO/stefan.blumentrath/grass-7.4.0svn/etc/python/grass/pygrass/vector/abstract.py",
line 381, in open
self.n_lines = self.table.n_rows()
File
"/home/NINA.NO/stefan.blumentrath/grass-7.4.0svn/etc/python/grass/pygrass/vector/table.py",
line 1053, in n_rows
cur.execute(sql.SELECT.format(cols='Count(*)', tname=self.name))
sqlite3.OperationalError: no such table: test_end
}}}
However, after a bit of troubleshooting, I realized that the dots were
causing the issue.
Would be helpful if pygrass could check for "GRASS compliant" column names
and give more specific error messages. An alternative could be to support
quoted identifiers throughout the code, but that is probably a too big
effort (or something for GRASS 8?)...
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3490>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list