[GRASS-dev] [GRASS GIS] #2510: v.db.addcolumn, bad parser syntax in script causes error, cascades to other modules

GRASS GIS trac at osgeo.org
Wed Dec 10 11:30:27 PST 2014


#2510: v.db.addcolumn, bad parser syntax in script causes error, cascades to other
modules
-------------------------------------------+--------------------------------
 Reporter:  isaacullah                     |       Owner:  grass-dev@…              
     Type:  defect                         |      Status:  new                      
 Priority:  major                          |   Milestone:  7.0.0                    
Component:  Vector                         |     Version:  svn-releasebranch70      
 Keywords:  parser, syntax, error, script  |    Platform:  Linux                    
      Cpu:  x86-64                         |  
-------------------------------------------+--------------------------------
 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.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2510>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list