Opened 10 years ago
Closed 9 years ago
#2510 closed defect (fixed)
v.db.addcolumn, bad parser syntax in script causes error, cascades to other modules
Reported by: | isaacullah | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 7.0.0 |
Component: | Vector | Version: | svn-releasebranch70 |
Keywords: | parser, v.db.addcolumn | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
Hi all,
In latest version of 7 from GRASS stable Ubuntu PPA archive, v.db.addcolumn is broken because of a change to the parser code in the script. The error is:
ERROR: Sorry, <map> is not a valid parameter ERROR: Required parameter <output> not set: (Name for output vector map)
But this is because the only options are "output", and "map" and "layer" don't show up. Looking at the script, I see that the relevant parser code in the header is this:
#%module #% description: Adds one or more columns to the attribute table connected to a given vector map. #% keywords: vector #% keywords: attribute table #% keywords: database #%end #%option G_OPT_V_MAP #%end #%option G_OPT_V_FIELD #% label: Layer number where to add column(s) #%end #%option #% key: columns #% type: string #% label: Name and type of the new column(s) ('name type [,name type, ...]') #% description: Data types depend on database backend, but all support VARCHAR(), INT, DOUBLE PRECISION and DATE #% required: yes #%end
It's obvious that it's the "G_OPT_V_MAP" and "G_OPT_V_FIELD" that are causing the error. I've not ever used that syntax in my own scripts (I wasn't aware that one *cold* do that, actually), but th error is fixed by changing to the "normal" parser syntax:
#%module #% description: Adds one or more columns to the attribute table connected to a given vector map. #% keywords: vector #% keywords: attribute table #% keywords: database #%end #%option #% key: map #% type: string #% gisprompt: old,vector,vector #% label: Name of map to add columns to the database #% required: yes #%end #%option #% key: layer #% type: integer #% label: Layer number where to add column(s) #% answer: 1 #% required: yes #%end #%option #% key: columns #% type: string #% label: Name and type of the new column(s) ('name type [,name type, ...]') #% description: Data types depend on database backend, but all support VARCHAR(), INT, DOUBLE PRECISION and DATE #% required: yes #%end
Not sure if the v.db.addcolumn code was always like that, and the error is caused by some other change, or if this is due to a recent change to the script itself, but it seems like an easy fix. This is a serious bug because it breaks a lot of the other vector tools.
Change History (3)
comment:1 by , 10 years ago
Keywords: | v.db.addcolumn added; syntax error script removed |
---|
Replying to isaacullah:
Is it really the latest you are using there? We have made a major code cleanup, perhaps the package was created in the "transition days"?
I just tried, works fine with the really current version: