[GRASS-dev] [GRASS GIS] #2008: grass.script's find_program() can't find modules

GRASS GIS trac at osgeo.org
Fri Jun 21 11:28:18 PDT 2013

#2008: grass.script's find_program() can't find modules
  Reporter:  hamish    |       Owner:  grass-dev@…              
      Type:  defect    |      Status:  reopened                 
  Priority:  critical  |   Milestone:  6.4.4                    
 Component:  Python    |     Version:  svn-releasebranch64      
Resolution:            |    Keywords:  find_program()           
  Platform:  All       |         Cpu:  x86-64                   

Comment(by wenzeslaus):

 Replying to [comment:24 wenzeslaus]:
 > I was about to commit the special case for the `explorer` cmd on MS Win.
 However, there is also a special case for `xdg-open`, I'm not sure why.
 Moreover, I tested also other command and e.g. `firefox` blocks the
 g.manual (it also blocks the cmd line when launched without &). On the
 other hand, in case of g.manual it opens the requested page, so it means
 that it goes behind the `call` function in `find_program`. This confuses
 me, I'would expect that the `wait()` call in `call` function
 implementation should block the interpreter sooner (i.e. in
 I tested it again and I probably did some mistake before. `firefox` and
 `chromium-browser` blocks `g.manual` in `find_program` (browser starts
 empty). `xdg-open`, `gnome-open` and `kde-open` works well.

 I still don't know why there was special case for `xdg-open`.

 Alternatively, we don't need to do `find_program`/`test_program` for
 browser, we can just run and report only after `os.execlp` (now there is
 an error message anyway).

 Replying to [comment:25 annakrat]:
 > Why not to have two functions: find_program - behaves like which
 command, test_program - or something similar which tests the program by
 calling it. For web browsers we could use the which implementation.

 Maybe, also the third one for `test_(grass_)module` for GRASS modules?
 (Than, we would use `test_module('r.sun')` instead of
 `test_program('r.sun', '--help')`) The point is that we need special cases
 anyway, so why not to make it explicit.

Ticket URL: <https://trac.osgeo.org/grass/ticket/2008#comment:26>
GRASS GIS <http://grass.osgeo.org>

More information about the grass-dev mailing list