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

GRASS GIS trac at osgeo.org
Wed Jun 19 06:26:42 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 annakrat):

 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
 > }}}
 >
 > In python3.3 they add this function in "shutil.which"
 >
 > http://hg.python.org/cpython/file/6860263c05b3/Lib/shutil.py#l1068

 The function from the link is more complicated, than what you suggest
 above. Why not to use the official one?

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



More information about the grass-dev mailing list