[GRASS-dev] [GRASS GIS] #2133: g.parser does call the form.py with full path

GRASS GIS trac at osgeo.org
Wed Nov 13 15:13:06 PST 2013


#2133: g.parser does call the form.py with full path
------------------------+---------------------------------------------------
 Reporter:  wenzeslaus  |       Owner:  grass-dev@…              
     Type:  defect      |      Status:  new                      
 Priority:  normal      |   Milestone:  7.0.0                    
Component:  wxGUI       |     Version:  svn-trunk                
 Keywords:  parser      |    Platform:  All                      
      Cpu:  All         |  
------------------------+---------------------------------------------------
 When I run `gui/wxpython/gui_core/forms.py` directly with full path:

 {{{
 python gui_core/forms.py ../../temporal/t.list/t.list.py
 }}}

 I get the module form/dialog (task frame) for the command and following
 debug output (`g.gisenv set=WX_DEBUG=1`):

 {{{
 GUI D1/1: forms.py called using command: ../../temporal/t.list/t.list.py
 GUI D1/1: forms.py opening form for: ['t.list.py']
 }}}

 However, when I run the module itself (here with `--ui` because of other
 parameters):

 {{{
 ../../temporal/t.list/t.list.py --ui
 }}}

 I don't get the GUI for module, I get an error dialog with message:

 {{{
 Unable to fetch interface description for command 't.list.py'.

 Details: [Errno 2] No such file or directory

 Try to set up GRASS_ADDON_PATH or GRASS_ADDON_BASE variable.
 }}}

 and the reason is actually clear from the debug output:

 {{{
 GUI D1/1: forms.py called using command: t.list.py type="strds"
 temporaltype="absolute,relative" order="id" columns="id"
 GUI D1/1: forms.py opening form for: ['unknown']
 }}}

 The parser mechanism does not pass the full path to file, so it is not
 found by the `task.py` mechanism. The task.py should probably end with
 some other error then setting the name to `unknown` but that's another
 story.

 The function responsible for running GUI is `module_gui_wx` in
 `lib/gis/parser.c`. It is passing result of `G_recreate_command()` as a
 first parameter and this works pretty well. The problem is that it returns
 only base name of the command returned by `G_program_name()` which uses
 global variable set by `G_set_program_name` function which stripes the
 name to using `G_basename` function.

 I cannot go further because `G_recreate_command` does not have any useful
 documentations (the only line of doc is related to non-interactivity which
 is really outdated). I hope that some others knows what is the concept of
 this and so what is the right solution.

 This functionality is important for testing non-core modules
 (addons/extensions) and more importantly it is crucial for running user
 scripts or scripts distributed in other way then GRASS Addons repository.

 Note that you need at least r58212 (GRASS 7) to test this because I added
 the debug messages in r58212. By the way, I've fixed the two tests there
 and extended usage suggestions when you run it without parameters.

 *This is the second Trac component I'm suggesting in past few weeks but
 what about Parser/G_parser/GRASS Parser/g.parser component*.

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



More information about the grass-dev mailing list