[GRASS-dev] [GRASS GIS] #2709: pyGRASS Module runs twice from interactive Python prompt

#2709: pyGRASS Module runs twice from interactive Python prompt
--------------------------+--------------------------------
  Reporter: martinl | Owner:
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.4
Component: PyGRASS | Version: unspecified
Resolution: | Keywords: interactive prompt
       CPU: Unspecified | Platform: Linux
--------------------------+--------------------------------

Comment (by neteler):

I just checked and something is pretty wrong:

{{{
GRASS 7.1.svn (eu_laea):~ > python
Python 2.7.10 (default, Sep 8 2015, 17:20:17)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from grass.pygrass.modules import Module
>>> Module('g.extension', flags='a')
List of installed extensions (modules):
r.skyview
i.segment.hierarchical
Module('g.extension') <<== ???
}}}

Anyway, now entering the next command from the original report:

{{{
>>> Module('r.mask', flags='r')
ERROR: No existing MASK to remove

Description:
  Maintains GRASS Addons extensions in local GRASS installation.
  Downloads and installs extensions from GRASS Addons repository or other
source into the local GRASS installation or removes installed extensions.

Keywords:
  general, installation, extensions, addons, download <<<-- ???

Usage:
  g.extension [-lcgasdift] extension=name operation=string [url=url]
    [prefix=path] [proxy=proxy[,proxy,...]] [--help] [--verbose] [--quiet]
    [--ui]

Flags:
   -l List available extensions in the official GRASS GIS Addons
repository
[...]
               default: $GRASS_ADDON_BASE
       proxy Set the proxy with: "http=<value>,ftp=<value>"

ERROR: Options <extension>, <-l>, <-c>, <-g> and <-a> are mutually
exclusive

Description:
  Maintains GRASS Addons extensions in local GRASS installation.
[...]

Keywords:
  general, installation, extensions, addons, download

Usage:
  g.extension [-lcgasdift] extension=name operation=string [url=url]
    [prefix=path] [proxy=proxy[,proxy,...]] [--help] [--verbose] [--quiet]
    [--ui]
[...]
}}}

... now there is some "ghost process"... finishing in a loop:

{{{
[...]
ERROR: Options <extension>, <-l>, <-c>, <-g> and <-a> are mutually
exclusive
^CTraceback (most recent call last):
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/scripts/g.extension", line 134, in <module>
     import shutil
   File "/usr/lib64/python2.7/shutil.py", line 5, in <module>
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 526, in
__init__
     self.__call__(*args, **kargs)
     """
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 583, in
__call__
KeyboardInterrupt
     return self.run()
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 713, in
run
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 526, in
__init__
     module=self.name, errors=stderr)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/exceptions/__init__.py", line 68, in __init__
         msg = _("Module run %s %s ended with error") % (module, code)
self.__call__(*args, **kargs)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 583, in
__call__
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 583, in
__call__
[...]
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 713, in
run
     module=self.name, errors=stderr)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/exceptions/__init__.py", line 68, in __init__
     msg = _("Module run %s %s ended with error") % (module, code)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 583, in
__call__
     return self.run()
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 713, in
run
     module=self.name, errors=stderr)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/exceptions/__init__.py", line 68, in __init__
     msg = _("Module run %s %s ended with error") % (module, code)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 583, in
__call__
     return self.run()
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 713, in
run
     module=self.name, errors=stderr)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/exceptions/__init__.py", line 68, in __init__
     msg = _("Module run %s %s ended with error") % (module, code)
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 583, in
__call__
     return self.run()
   File "/home/neteler/software/grass71/dist.x86_64-pc-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 706, in
run
     stdout, stderr = self.popen.communicate(input=self.stdin)
   File "/usr/lib64/python2.7/subprocess.py", line 796, in communicate
     self.wait()
   File "/usr/lib64/python2.7/subprocess.py", line 1384, in wait
     pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
   File "/usr/lib64/python2.7/subprocess.py", line 476, in
_eintr_retry_call
     return func(*args)
KeyboardInterrupt
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2709#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>