Opened 10 years ago
Closed 10 years ago
#2547 closed defect (fixed)
v.report: should report stats even if there is no attribute table (or at least fail more gracefully)
Reported by: | mlennert | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.0 |
Component: | Vector | Version: | svn-releasebranch70 |
Keywords: | v.report vector_columns attribute table | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
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...
Change History (3)
follow-up: 2 comment:1 by , 10 years ago
comment:2 by , 10 years ago
Replying to 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
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.