[GRASS-dev] [GRASS GIS] #2547: v.report: should report stats even if there is no attribute table (or at least fail more gracefully)

#2547: v.report: should report stats even if there is no attribute table (or at
least fail more gracefully)
-----------------------------------------------------+----------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: v.report vector_columns attribute table | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------------------------+----------------------
{{{
v.net input=streets_wake points=schools_wake output=network
operation=connect threshold=500
v.net.alloc input=network output=alloc center_cats=1-9999
v.report alloc op=lengthTraceback (most recent call last):
   File "/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64-unknown-
linux-gnu/scripts/v.report", line 185, in <module>
     main()
   File "/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64-unknown-
linux-gnu/scripts/v.report", line 70, in main
     colnames = grass.vector_columns(mapname, layer, getDict = False,
stderr = nuldev)
   File "/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64-unknown-
linux-gnu/etc/python/grass/script/vector.py", line 120, in vector_columns
     **args)
   File "/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64-unknown-
linux-gnu/etc/python/grass/script/core.py", line 427, in read_command
     return handle_errors(returncode, stdout, args, kwargs)
   File "/data/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64-unknown-
linux-gnu/etc/python/grass/script/core.py", line 310, in handle_errors
     returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['v.info', '--q',
'-c', 'map=alloc', 'layer=1'] ended with error
Process ended with non-zero return code 1. See errors in the (error)
output.
}}}

I think v.report should just report stat by cat in such a case, but at
least there should be a graceful exit explaining that an attribute table
is needed.

I guess this is as much a bug in vector_columns() in grass.script as it is
a bug in v.report...

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2547&gt;
GRASS GIS <http://grass.osgeo.org>

#2547: v.report: should report stats even if there is no attribute table (or at
least fail more gracefully)
-----------------------------------------------------+----------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: v.report vector_columns attribute table | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------------------------+----------------------

Comment(by annakrat):

We shouldn't use `vector_columns` on vector maps without attribute table
linked to the layer. Also, if I understand it correctly, part of the code
was not used at all. I committed a change in r64134, but please test it,
both with and without connection. I was confused from the module because I
don't think I was using it before and the manual page is brief, so it
would be good if someone makes sure my changes make sense.

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

#2547: v.report: should report stats even if there is no attribute table (or at
least fail more gracefully)
-----------------------------------------------------+----------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: v.report vector_columns attribute table | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------------------------+----------------------

Comment(by mlennert):

Replying to [comment:1 annakrat]:
> We shouldn't use `vector_columns` on vector maps without attribute table
linked to the layer. Also, if I understand it correctly, part of the code
was not used at all. I committed a change in r64134, but please test it,
both with and without connection. I was confused from the module because I
don't think I was using it before and the manual page is brief, so it
would be good if someone makes sure my changes make sense.

I think your change is a very good way of dealing with the issue and the
result works as expected, now. Thanks a lot !

This can probably be backported to relbr7. Leaving the ticket open for
that.

Moritz

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

#2547: v.report: should report stats even if there is no attribute table (or at
least fail more gracefully)
--------------------------+-------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Resolution: fixed | Keywords: v.report vector_columns attribute table
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by annakrat):

  * status: new => closed
  * resolution: => fixed

Comment:

Backported in r64172.

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