[GRASS-dev] [GRASS GIS] #2326: Command functions in grass.script.core miss a correct error reporting

GRASS GIS trac at osgeo.org
Fri Jun 6 00:40:05 PDT 2014


#2326: Command functions in grass.script.core miss a correct error reporting
-------------------------+--------------------------------------------------
 Reporter:  wenzeslaus   |       Owner:  grass-dev@…              
     Type:  enhancement  |      Status:  new                      
 Priority:  normal       |   Milestone:  7.1.0                    
Component:  Python       |     Version:  svn-trunk                
 Keywords:  script       |    Platform:  All                      
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------

Comment(by zarch):

 Replying to [ticket:2326 wenzeslaus]:
 > Also, I'm not sure what is the PyGRASS's answer to this problem.

 [[BR]]

 At the moment in the Module class the returncode is not checked at all.

 {{{
 #!python
 >>> from subprocess import PIPE
 >>> from grass.pygrass.modules import Module
 >>>
 >>> greg = Module('g.region', flags='p', rast='ELEV', stdout_=PIPE,
 stderr_=PIPE)
 >>> greg.popen.returncode
 1
 >>> greg.outputs.stderr
 'ERROR: Raster map <ELEV> not found\n'
 }}}

 [[BR]]

 I can modify the Module class behaviour changing the default parameters
 for stdout_ and stderr_ to PIPE (at the moment are None), and raise a
 RuntimeError if the returncode is not 0.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2326#comment:2>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list