[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 02:41:11 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 glynn):

 Replying to [comment:2 zarch]:

 > I can modify the Module class behaviour changing the default parameters
 for stdout_ and stderr_ to PIPE

 That's probably unwise. It would force the caller to either explicitly set
 them to None or to consume the output, e.g. via the .communicate() method.

 I wouldn't be surprised if many scripts do neither; the result being that
 the call works fine unless it writes more than a buffer's worth of output,
 in which case it will just hang.

 I also wouldn't be surprised if scripts try to re-implement logic similar
 to .communicate() but get it wrong. You need to use either threads or non-
 blocking I/O. If you perform a blocking read on either pipe and more than
 a buffer's worth of data is written to the other pipe, you get deadlock
 (i.e. the script hangs).

 Also, when both stdout and stderr are associated with different pipes,
 it's impossible to reconstruct the "normal" output because there's no way
 to determine the relative order. Meaning that you can't e.g. associate an
 error message with any particular line of progress output. This is why the
 support for "stdout=PIPE, stderr=STDOUT" exists.

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



More information about the grass-dev mailing list