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

GRASS GIS trac at osgeo.org
Mon Oct 6 00:49:10 PDT 2014


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

Comment(by zarch):

 Replying to [comment:20 wenzeslaus]:
 > Replying to [comment:19 glynn]:
 > > Replying to [comment:18 wenzeslaus]:
 > > > What do you (all) think about moving the function `call_module()`
 > > > from testing framework into the `grass.script.core` module?
 > >
 > > My concern is that people might use it when the existing
 > > commands (once the error handling is fixed) would be more
 > > appropriate.
 > >
 > > > The main point of this function is that it raises exception
 > > > when return code of the module is non-zero.
 > >
 > > The existing commands should be changed to do that.
 >
 > This is a serious change which will require a lot of
 > testing in both modules (core and addons) and GUI.
 > What are the opinions on doing something like that?

 I think we should move on this direction.


 > The alternative is to go for 7.x and probably even
 > further (8.x) with the current unsafe but broadly
 > used API which can be used right in most of the
 > cases (but not e.g. in case of `read_command()`).
 > We may provide better alternatives and propose them
 > when they are ready. We can also do some static
 > source code checks (using regexp) which would
 > look for using the return values of `run_command()` etc.

 To me it looks more dangerous to not check the return code than raise an
 exception.
 Since until now there are not check the author assume that there will be
 not problem so if this condition is true, it will still true after this
 change, so there will be not new problems.

 We have only to change where the return code is checked, but fortunately,
 as you pointed out, this is quite rare case so I think should be feasible
 for grass7.0

 the file that need to be changed in that case are mainly the temporal
 framework and the gui/wypython:

 {{{
 $ grep --color=auto --exclude-dir={.svn,.git,.OBJ,locale} -IrnE
 "returncode"
 lib/python/pygrass/tools/multi_import.py:54:    return path, name, False
 if popen.returncode else True
 lib/python/pygrass/tools/multi_import2.py:25:   ...
 print(mapcalc.popen.returncode)
 lib/python/pygrass/modules/interface/module.py:57:    ...
 print(mapcalc.popen.returncode)
 lib/python/pygrass/modules/interface/module.py:144:                if
 proc.popen.returncode != 0:
 lib/python/pygrass/modules/interface/module.py:208:    >>>
 mapcalc.popen.returncode
 lib/python/pygrass/modules/interface/module.py:216:    >>>
 colors.popen.returncode
 lib/python/pygrass/modules/interface/module.py:230:    >>>
 colors.popen.returncode
 lib/python/pygrass/modules/interface/module.py:241:    >>>
 colors.popen.returncode
 lib/python/pygrass/modules/interface/module.py:251:    >>>
 colors.popen.returncode
 lib/python/pygrass/modules/interface/module.py:583:                raise
 CalledModuleError(returncode=self.popen.returncode,
 lib/python/gunittest/gmodules.py:30:    >>> mapcalc.popen.returncode
 lib/python/gunittest/gmodules.py:37:    >>> colors.popen.returncode
 lib/python/gunittest/gmodules.py:129:    returncode = process.poll()
 lib/python/gunittest/gmodules.py:130:    if returncode:
 lib/python/gunittest/gmodules.py:131:        raise
 CalledModuleError(returncode, module, kwargs, errors)
 lib/python/gunittest/case.py:954:            raise
 CalledModuleError(module.popen.returncode, module.name,
 lib/python/gunittest/case.py:978:    # TODO: do we need special function
 for testing module failures or just add parameter returncode=0?
 lib/python/gunittest/case.py:1012:                      ' with non-zero
 return code ({m.popen.returncode})\n'
 lib/python/gunittest/invoker.py:43:def update_keyval_file(filename,
 module, returncode):
 lib/python/gunittest/invoker.py:60:        keyval['status'] = 'failed' if
 returncode else 'passed'
 lib/python/gunittest/invoker.py:61:    keyval['returncode'] = returncode
 lib/python/gunittest/invoker.py:181:        returncode = p.wait()
 lib/python/gunittest/invoker.py:188:            module=module,
 returncode=returncode)
 lib/python/gunittest/invoker.py:190:
 returncode=returncode,
 lib/python/gunittest/reporters.py:390:    def end_file_test(self,
 returncode, **kwargs):
 lib/python/gunittest/reporters.py:394:        if returncode:
 lib/python/gunittest/reporters.py:455:def
 returncode_to_html_text(returncode):
 lib/python/gunittest/reporters.py:456:    if returncode:
 lib/python/gunittest/reporters.py:464:def
 returncode_to_html_sentence(returncode):
 lib/python/gunittest/reporters.py:465:    if returncode:
 lib/python/gunittest/reporters.py:467:                ' Test failed
 (return code %d)' % (returncode))
 lib/python/gunittest/reporters.py:470:                ' Test succeeded
 (return code %d)' % (returncode))
 lib/python/gunittest/reporters.py:473:def
 returncode_to_success_html_par(returncode):
 lib/python/gunittest/reporters.py:474:    if returncode:
 lib/python/gunittest/reporters.py:608:    def end_file_test(self, module,
 cwd, returncode, stdout, stderr,
 lib/python/gunittest/reporters.py:611:            module=module, cwd=cwd,
 returncode=returncode,
 lib/python/gunittest/reporters.py:655:
 status=returncode_to_html_text(returncode),
 lib/python/gunittest/reporters.py:674:
 status=returncode_to_success_html_par(returncode),
 lib/python/gunittest/reporters.py:691:
 status=returncode_to_html_text(returncode),
 lib/python/gunittest/reporters.py:693:                ptests=pass_per,
 rc=returncode,
 lib/python/gunittest/reporters.py:734:        if returncode:
 lib/python/gunittest/reporters.py:741:        if returncode:
 lib/python/gunittest/reporters.py:774:        self.files_returncodes = []
 lib/python/gunittest/reporters.py:798:        summary['files_returncodes']
 = [str(item)
 lib/python/gunittest/reporters.py:799:
 for item in self.files_returncodes]
 lib/python/gunittest/reporters.py:833:    def end_file_test(self, module,
 cwd, returncode, stdout, stderr,
 lib/python/gunittest/reporters.py:836:            module=module, cwd=cwd,
 returncode=returncode,
 lib/python/gunittest/reporters.py:868:
 self.files_returncodes.append(returncode)
 lib/python/gunittest/reporters.py:923:    def end_file_test(self, module,
 cwd, returncode, stdout, stderr,
 lib/python/gunittest/reporters.py:926:            module=module, cwd=cwd,
 returncode=returncode,
 lib/python/gunittest/reporters.py:929:        if returncode:
 lib/python/gunittest/reporters.py:1053:            file_successes += 0 if
 summary['returncode'] else 1
 lib/python/gunittest/reporters.py:1066:
 status=returncode_to_html_text(summary['returncode']),
 lib/python/gunittest/multirunner.py:61:    if p.returncode != 0:
 lib/python/gunittest/multirunner.py:100:        returncode = p.wait()
 lib/python/gunittest/multirunner.py:108:        returncode = p.wait()
 lib/python/gunittest/multirunner.py:109:        if returncode != 0:
 lib/python/temporal/temporal_vector_algebra.py:607:        returncode =
 TemporalAlgebraParser.overlay_map_extent(self, mapA, mapB,
 lib/python/temporal/temporal_vector_algebra.py:610:        if not copy and
 returncode == 1:
 lib/python/temporal/temporal_vector_algebra.py:617:
 return(returncode)
 lib/python/temporal/temporal_vector_algebra.py:632:
 returncode = 0
 lib/python/temporal/temporal_vector_algebra.py:663:
 returncode = 1
 lib/python/temporal/temporal_vector_algebra.py:670:
 if cmd.popen.returncode != 0:
 lib/python/temporal/temporal_vector_algebra.py:680:
 returncode = 1
 lib/python/temporal/temporal_vector_algebra.py:682:
 if returncode == 0:
 lib/python/temporal/temporal_vector_algebra.py:828:
 returncode = self.overlay_map_extent(map_new, map_j, opname, \
 lib/python/temporal/temporal_vector_algebra.py:831:
 if returncode == 0:
 lib/python/temporal/temporal_vector_algebra.py:866:
 if returncode == 0:
 lib/python/temporal/temporal_vector_algebra.py:869:                if
 returncode == 1:
 lib/python/temporal/temporal_algebra.py:746:        returncode = 1
 lib/python/temporal/temporal_algebra.py:762:                    returncode
 = 0
 lib/python/temporal/temporal_algebra.py:768:                    returncode
 = 0
 lib/python/temporal/temporal_algebra.py:774:                    returncode
 = 0
 lib/python/temporal/temporal_algebra.py:782:                    returncode
 = 0
 lib/python/temporal/temporal_algebra.py:788:                    returncode
 = 0
 lib/python/temporal/temporal_algebra.py:794:                    returncode
 = 0
 lib/python/temporal/temporal_algebra.py:796:        return(returncode)
 lib/python/temporal/temporal_raster_base_algebra.py:277:
 returncode = 0
 lib/python/temporal/temporal_raster_base_algebra.py:393:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:396:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:426:                if
 returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:534:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:537:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:568:                if
 returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:666:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:668:
 print(returncode)
 lib/python/temporal/temporal_raster_base_algebra.py:670:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:705:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:708:                if
 returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:746:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:749:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:780:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:783:                if
 returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:958:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:961:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:987:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1048:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1051:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1077:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1147:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1150:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1178:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1256:
 returncode = self.overlay_map_extent(map_new, map_then, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1260:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1267:
 returncode = self.overlay_map_extent(map_new, map_else, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1271:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1312:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1425:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1428:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1470:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1544:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1547:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1589:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1678:
 returncode = self.overlay_map_extent(map_new, map_then, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1682:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1689:
 returncode = self.overlay_map_extent(map_new, map_else, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1693:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1734:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1820:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1823:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1849:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1887:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1890:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1916:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:1967:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:1970:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:1996:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:2133:
 returncode = self.overlay_map_extent(map_new, map_then, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:2137:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:2144:
 returncode = self.overlay_map_extent(map_new, map_else, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:2148:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:2189:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:2294:
 returncode = self.overlay_map_extent(map_new, map_then, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:2298:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:2305:
 returncode = self.overlay_map_extent(map_new, map_else, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:2309:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:2350:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:2485:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:2488:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:2530:
 if returncode == 1:
 lib/python/temporal/temporal_raster_base_algebra.py:2613:
 returncode = self.overlay_map_extent(map_new, map_j, 'and', \
 lib/python/temporal/temporal_raster_base_algebra.py:2616:
 if returncode == 0:
 lib/python/temporal/temporal_raster_base_algebra.py:2658:
 if returncode == 1:
 lib/python/script/task.py:487:        if p.returncode != 0:
 lib/python/script/core.py:648:        sys.exit(p.returncode)
 lib/python/script/core.py:1328:        if ps.returncode != 0 and error:
 lib/python/exceptions/__init__.py:60:    :param rc: process returncode
 lib/python/exceptions/__init__.py:63:    def __init__(self, module, code,
 returncode, errors=None):
 lib/python/exceptions/__init__.py:64:        super(CalledModuleError,
 self).__init__(returncode, module)
 lib/python/exceptions/__init__.py:66:        msg += _("\nProcess ended
 with non-zero return code %s") % returncode
 lib/init/grass.py:547:            if p.returncode == 0:
 scripts/r.in.wms/wms_base.py:390:            if ps.returncode != 0:
 scripts/r.reclass.area/r.reclass.area.py:153:    if p2.returncode != 0:
 scripts/db.droptable/db.droptable.py:94:    if p.returncode != 0:
 scripts/v.report/v.report.py:98:        if p.returncode != 0:
 scripts/v.out.gps/v.out.gps.py:215:    if p1.returncode != 0 or
 p2.returncode != 0:
 scripts/v.out.gps/v.out.gps.py:232:    if p3.returncode != 0:
 scripts/m.proj/m.proj.py:280:    if p.returncode != 0:
 scripts/v.in.gps/v.in.gps.py:215:#     if p1.returncode != 0 or
 p2.returncode != 0:
 scripts/v.in.gps/v.in.gps.py:232:#     if p3.returncode != 0:
 gui/wxpython/vnet/vnet_core.py:136:    def RunAnDone(self, cmd,
 returncode, results):
 gui/wxpython/vnet/vnet_core.py:285:    def _createTtbDone(self, cmd,
 returncode):
 gui/wxpython/vnet/vnet_core.py:287:        if returncode != 0:
 gui/wxpython/vnet/vnet_core.py:305:        self.ttbCreated.emit(returncode
 = returncode)
 gui/wxpython/vnet/vnet_core.py:463:    def _vnetPathRunTurnsAnDone(self,
 cmd, returncode):
 gui/wxpython/vnet/vnet_core.py:466:        self._vnetPathRunAnDone(cmd,
 returncode)
 gui/wxpython/vnet/vnet_core.py:468:    def _vnetPathRunAnDone(self, cmd,
 returncode):
 gui/wxpython/vnet/vnet_core.py:472:        self._onDone(cmd, returncode)
 gui/wxpython/vnet/vnet_core.py:474:    def _onDone(self, cmd, returncode):
 gui/wxpython/vnet/vnet_core.py:480:        self.onAnDone(cmd, returncode,
 output)
 gui/wxpython/vnet/vnet_core.py:588:    def _runTurnsAnDone(self, cmd,
 returncode):
 gui/wxpython/vnet/vnet_core.py:592:        self._onDone(cmd, returncode)
 gui/wxpython/vnet/vnet_core.py:694:    def _runAnDone(self, cmd,
 returncode):
 gui/wxpython/vnet/vnet_core.py:703:        self._onDone(cmd, returncode)
 gui/wxpython/iscatt/iscatt_core.py:139:        returncode, scatts =
 ComputeScatts(self.an_data.GetRegion(),
 gui/wxpython/iscatt/iscatt_core.py:147:        if returncode < 0:
 gui/wxpython/gui_core/dialogs.py:1149:    def ShowResult(self, group,
 returnCode, create):
 gui/wxpython/gui_core/dialogs.py:1152:        if returnCode is None:
 gui/wxpython/gui_core/dialogs.py:1154:        elif returnCode == 0:
 gui/wxpython/gui_core/dialogs.py:1218:            self.ShowResult(group =
 group, returnCode = ret, create = False)
 gui/wxpython/gui_core/dialogs.py:1222:            self.ShowResult(group =
 group, returnCode = ret, create = True)
 gui/wxpython/gui_core/dialogs.py:1764:    def AddLayers(self, returncode,
 cmd = None):
 gui/wxpython/gui_core/dialogs.py:1766:        if not self.add.IsChecked()
 or returncode != 0:
 gui/wxpython/gui_core/dialogs.py:1810:    def OnCmdDone(self, cmd,
 returncode):
 gui/wxpython/gui_core/dialogs.py:1930:    def OnCmdDone(self, cmd,
 returncode):
 gui/wxpython/gui_core/dialogs.py:1935:        self.AddLayers(cmd,
 returncode)
 gui/wxpython/gui_core/dialogs.py:1940:        if returncode == 0 and
 self.closeOnFinish.IsChecked():
 gui/wxpython/gui_core/dialogs.py:2100:    def OnCmdDone(self, cmd,
 returncode):
 gui/wxpython/gui_core/dialogs.py:2105:        self.AddLayers(cmd,
 returncode)
 gui/wxpython/gui_core/forms.py:619:    def OnDone(self, cmd, returncode):
 gui/wxpython/gui_core/forms.py:623:        :param returncode: command's
 return code (0 for success)
 gui/wxpython/gui_core/forms.py:642:                    (returncode == 0):
 gui/wxpython/gcp/manager.py:680:            if p.returncode == 0:
 gui/wxpython/gcp/manager.py:681:                print 'returncode = ',
 str(p.returncode)
 gui/wxpython/gcp/manager.py:1480:        returncode = kargs['returncode']
 gui/wxpython/gcp/manager.py:1482:        if returncode == 0:
 gui/wxpython/web_services/widgets.py:475:        if event.returncode != 0:
 gui/wxpython/gis_set.py:523:            returncode, error =
 RunCommand('v.in.ogr', dsn = filePath, output = mapName,
 gui/wxpython/gis_set.py:526:            returncode, error =
 RunCommand('r.in.gdal', input = filePath, output = mapName,
 gui/wxpython/gis_set.py:530:        if returncode != 0:
 gui/wxpython/modules/vclean.py:443:    def OnDone(self, cmd, returncode):
 gui/wxpython/modules/extensions.py:234:    def OnDone(self, cmd,
 returncode):
 gui/wxpython/modules/extensions.py:235:        if returncode == 0:
 gui/wxpython/modules/mcalc_builder.py:596:    def OnDone(self, cmd,
 returncode):
 gui/wxpython/modules/mcalc_builder.py:601:        if returncode != 0:
 gui/wxpython/lmgr/frame.py:497:    def OnDone(self, cmd, returncode):
 gui/wxpython/gmodeler/frame.py:506:    def OnDone(self, cmd, returncode):
 gui/wxpython/gmodeler/frame.py:1731:    def OnDone(self, cmd, returncode):
 gui/wxpython/psmap/frame.py:294:        if event.returncode != 0:
 gui/wxpython/psmap/frame.py:296:                     message = _("Ps.map
 exited with return code %s") % event.returncode)
 gui/wxpython/animation/provider.py:273:        returncode, stdout,
 messages = read2_command(cmdTuple[0], **cmdTuple[1])
 gui/wxpython/animation/provider.py:275:        if returncode == 0:
 gui/wxpython/animation/provider.py:494:    returncode, stdout, messages =
 read2_command(cmdTuple[0], **cmdTuple[1])
 gui/wxpython/animation/provider.py:495:    if returncode != 0:
 gui/wxpython/animation/provider.py:533:    returncode, stdout, messages =
 read2_command(cmdTuple[0], **cmdTuple[1])
 gui/wxpython/animation/provider.py:534:    if returncode != 0:
 gui/wxpython/animation/provider.py:571:    returncode, stdout, messages =
 read2_command('g.pnmcomp',
 gui/wxpython/animation/provider.py:581:    if returncode != 0:
 gui/wxpython/animation/provider.py:740:    return ps.returncode, stdout,
 stderr
 gui/wxpython/animation/nviztask.py:301:        returncode, message =
 RunCommand(getErrorMsg=True, prog=cmd[0], **cmd[1])
 gui/wxpython/animation/nviztask.py:302:        print returncode, message
 gui/wxpython/core/gcmd.py:348:        if cmd.returncode == None:
 gui/wxpython/core/gcmd.py:350:        elif cmd.returncode == 0:
 gui/wxpython/core/gcmd.py:353:            print 'FAILURE (%d)' %
 cmd.returncode
 gui/wxpython/core/gcmd.py:399:                self.returncode =
 self.cmdThread.module.returncode
 gui/wxpython/core/gcmd.py:401:                self.returncode = 1
 gui/wxpython/core/gcmd.py:404:            self.returncode = None
 gui/wxpython/core/gcmd.py:406:        if self.returncode is not None:
 gui/wxpython/core/gcmd.py:407:            Debug.msg (3, "Command():
 cmd='%s', wait=%s, returncode=%d, alive=%s" % \
 gui/wxpython/core/gcmd.py:408:                           (' '.join(cmd),
 wait, self.returncode, self.cmdThread.isAlive()))
 gui/wxpython/core/gcmd.py:409:            if rerr is not None and
 self.returncode != 0:
 gui/wxpython/core/gcmd.py:426:            Debug.msg (3, "Command():
 cmd='%s', wait=%s, returncode=?, alive=%s" % \
 gui/wxpython/core/gcmd.py:669:    :return: returncode (read == False and
 getErrorMsg == False)
 gui/wxpython/core/gcmd.py:670:    :return: returncode, messages (read ==
 False and getErrorMsg == True)
 gui/wxpython/core/gcmd.py:672:    :return: returncode, stdout, messages
 (read == True and getErrorMsg == True)
 gui/wxpython/core/gcmd.py:708:    ret = ps.returncode
 gui/wxpython/core/gconsole.py:158:                returncode =
 self.requestCmd.module.returncode
 gui/wxpython/core/gconsole.py:160:                returncode = 0  # being
 optimistic
 gui/wxpython/core/gconsole.py:200:
 returncode=returncode,
 gui/wxpython/core/gconsole.py:631:            event.onDone(cmd=event.cmd,
 returncode=event.returncode)
 gui/wxpython/core/gconsole.py:640:        if event.returncode != 0 or
 event.aborted:
 temporal/t.rast.accumulate/t.rast.accumulate.py:441:            if
 accmod.popen.returncode != 0:
 }}}


 And in grass-addons:

 {{{
 grep --color=auto --exclude-dir={.svn,.git,.OBJ,locale} -IrnE "returncode"
 ../grass_addons
 ../grass_addons/grass6/raster/r.in.wms2/wms_base.py:350:            if
 ps.returncode != 0:
 ../grass_addons/grass7/vector/v.lfp/v.lfp.py:54:    if p.returncode != 0
 or res == "":
 ../grass_addons/grass7/vector/v.lfp/v.lfp.py:80:        if p.returncode !=
 0 or lines == "":
 ../grass_addons/grass7/vector/v.lfp/v.lfp.py:101:        if p.returncode
 != 0:
 ../grass_addons/grass7/vector/v.lfp/v.lfp.py:126:    if p.returncode != 0
 or mincat == "" or maxcat == "":
 ../grass_addons/grass7/vector/v.lfp/v.lfp.py:148:        if p.returncode
 != 0 or startx == "" or starty == "":
 ../grass_addons/grass7/vector/v.in.wfs2/wfs_base.py:226:            if
 ps.returncode != 0:
 ../grass_addons/grass7/general/g.proj.all/g.proj.all.py:120:    returncode
 = gcore.run_command('r.proj', quiet=True, **parameters)
 ../grass_addons/grass7/general/g.proj.all/g.proj.all.py:121:    if
 returncode != 0:
 ../grass_addons/grass7/general/g.proj.all/g.proj.all.py:153:    returncode
 = gcore.run_command('v.proj', quiet=True, **parameters)
 ../grass_addons/grass7/general/g.proj.all/g.proj.all.py:154:    if
 returncode != 0:
 ../grass_addons/grass7/raster/r.lfp/r.lfp.py:52:    if p.returncode != 0:
 ../grass_addons/grass7/raster/r.lfp/r.lfp.py:84:    if p.returncode != 0
 or max == "":
 }}}

 So are 255 lines that need to be checked and adapted. 46 lines in
 gunittest, 85 in the temporal framework and 80 in wxpython.
 To me it looks feasible, especially if we split the load on 4/5 people.
 What do you think?

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



More information about the grass-dev mailing list