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

GRASS GIS trac at osgeo.org
Wed Jun 19 22:29:48 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 glynn):

 Replying to [comment:7 zarch]:

 > What about:
 >
 {{{
 def which(pgm):
     for p in os.getenv('PATH').split(os.path.pathsep):
         p = os.path.join(p, pgm)
         if os.path.exists(p) and os.access(p, os.X_OK):
             return p
 }}}

 That won't work on windows, where PATHEXT also has to be considered.

 There are probably other cases which it doesn't handle, e.g. the
 executable exists but cannot be run for whatever reason. The previous
 implementation (which will be reinstated today unless someone provides a
 legitimate reason not to) is robust against such issues.

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



More information about the grass-dev mailing list