[GRASS-dev] [Qgis-developer] New GRASS plugin: a test drive

On Mon, Oct 5, 2015 at 11:16 PM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

On Mon, Oct 5, 2015 at 1:16 PM, Radim Blazek <radim.blazek@gmail.com> wrote:

>> There is v.build.all in modules.
>
> yes, but the user has no hint about its necessity; further steps:
> db.connect -d
> v.db.reconnect.all -cd
> are not available among modules (BTW, maybe these options could be added
> to existing modules?).

Building broken topology from browser can be always useful, but I
don't think that browser/plugin must have UI for upgrading GRASS data
from 6 to 7, something which has to be rarely done and which should be
done with understanding (upgrade from dbf to sqlite).

Perhaps a special plugin. Do you think it would be a good idea to have
plugins based on the GRASS plugin? (They would probably just call modules
but in the way GRASS plugin does.)

I have added qgis.v.upgrade.py which runs
  v.build.all
  db.connect -d
  v.db.reconnect.all -cd

but v.db.reconnect.all fails with -d even from GRASS shell:

Reconnecting vector map <lines@upgrade> (1 of 3)...
--------------------------------------------------------------------------------
Copying table <lines> to target database...
Traceback (most recent call last):
  File "grass-7.1.svn/scripts/db.droptable", line 99, in <module>
    main()
  File "grass-7.1.svn/scripts/db.droptable", line 77, in main
    used = grass.db.db_table_in_vector(table)
  File "grass-7.1.svn/etc/python/grass/script/db.py", line 189, in
db_table_in_vector
    for f in vector_db(vect, stderr=nuldev).itervalues():
  File "grass-7.1.svn/etc/python/grass/script/vector.py", line 46, in vector_db
    **args)
  File "/grass-7.1.svn/etc/python/grass/script/core.py", line 460, in
read_command
    return handle_errors(returncode, stdout, args, kwargs)
  File "grass-7.1.svn/etc/python/grass/script/core.py", line 328, in
handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['v.db.connect',
'--q', '-g', 'map=edit@PERMANENT', 'sep=;'] ended with error
Process ended with non-zero return code 1. See errors in the (error) output.
ERROR: Unable to drop table <lines>

Radim

Il 06/10/2015 13:29, Radim Blazek ha scritto:

I have added qgis.v.upgrade.py which runs

fine, I like that.

but v.db.reconnect.all fails with -d even from GRASS shell:

here it worked well for a couple of locations.
All the best.

--
Paolo Cavallini - www.faunalia.eu
QGIS & PostGIS courses: http://www.faunalia.eu/training.html

Radim,
please provide information on source / target database (DBFs?
SQLite?); Are permissions set correctly? OS (Windows)?

2015-10-06 14:29 GMT+03:00 Radim Blazek <radim.blazek@gmail.com>:

On Mon, Oct 5, 2015 at 11:16 PM, Vaclav Petras <wenzeslaus@gmail.com> wrote:

On Mon, Oct 5, 2015 at 1:16 PM, Radim Blazek <radim.blazek@gmail.com> wrote:

>> There is v.build.all in modules.
>
> yes, but the user has no hint about its necessity; further steps:
> db.connect -d
> v.db.reconnect.all -cd
> are not available among modules (BTW, maybe these options could be added
> to existing modules?).

Building broken topology from browser can be always useful, but I
don't think that browser/plugin must have UI for upgrading GRASS data
from 6 to 7, something which has to be rarely done and which should be
done with understanding (upgrade from dbf to sqlite).

Perhaps a special plugin. Do you think it would be a good idea to have
plugins based on the GRASS plugin? (They would probably just call modules
but in the way GRASS plugin does.)

I have added qgis.v.upgrade.py which runs
  v.build.all
  db.connect -d
  v.db.reconnect.all -cd

but v.db.reconnect.all fails with -d even from GRASS shell:

Reconnecting vector map <lines@upgrade> (1 of 3)...
--------------------------------------------------------------------------------
Copying table <lines> to target database...
Traceback (most recent call last):
  File "grass-7.1.svn/scripts/db.droptable", line 99, in <module>
    main()
  File "grass-7.1.svn/scripts/db.droptable", line 77, in main
    used = grass.db.db_table_in_vector(table)
  File "grass-7.1.svn/etc/python/grass/script/db.py", line 189, in
db_table_in_vector
    for f in vector_db(vect, stderr=nuldev).itervalues():
  File "grass-7.1.svn/etc/python/grass/script/vector.py", line 46, in vector_db
    **args)
  File "/grass-7.1.svn/etc/python/grass/script/core.py", line 460, in
read_command
    return handle_errors(returncode, stdout, args, kwargs)
  File "grass-7.1.svn/etc/python/grass/script/core.py", line 328, in
handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['v.db.connect',
'--q', '-g', 'map=edit@PERMANENT', 'sep=;'] ended with error
Process ended with non-zero return code 1. See errors in the (error) output.
ERROR: Unable to drop table <lines>

Radim
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Tue, Oct 6, 2015 at 7:29 AM, Radim Blazek <radim.blazek@gmail.com> wrote:

On Mon, Oct 5, 2015 at 11:16 PM, Vaclav Petras <wenzeslaus@gmail.com>
wrote:
>
> On Mon, Oct 5, 2015 at 1:16 PM, Radim Blazek <radim.blazek@gmail.com>
wrote:
>>
>> >> There is v.build.all in modules.
>> >
>> > yes, but the user has no hint about its necessity; further steps:
>> > db.connect -d
>> > v.db.reconnect.all -cd
>> > are not available among modules (BTW, maybe these options could be
added
>> > to existing modules?).
>>
>> Building broken topology from browser can be always useful, but I
>> don't think that browser/plugin must have UI for upgrading GRASS data
>> from 6 to 7, something which has to be rarely done and which should be
>> done with understanding (upgrade from dbf to sqlite).
>
> Perhaps a special plugin. Do you think it would be a good idea to have
> plugins based on the GRASS plugin? (They would probably just call modules
> but in the way GRASS plugin does.)

I have added qgis.v.upgrade.py which runs
  v.build.all
  db.connect -d
  v.db.reconnect.all -cd

but v.db.reconnect.all fails with -d even from GRASS shell:

Reconnecting vector map <lines@upgrade> (1 of 3)...

--------------------------------------------------------------------------------
Copying table <lines> to target database...
Traceback (most recent call last):
  File "grass-7.1.svn/scripts/db.droptable", line 99, in <module>
    main()
  File "grass-7.1.svn/scripts/db.droptable", line 77, in main
    used = grass.db.db_table_in_vector(table)
  File "grass-7.1.svn/etc/python/grass/script/db.py", line 189, in
db_table_in_vector
    for f in vector_db(vect, stderr=nuldev).itervalues():
  File "grass-7.1.svn/etc/python/grass/script/vector.py", line 46, in
vector_db
    **args)
  File "/grass-7.1.svn/etc/python/grass/script/core.py", line 460, in
read_command
    return handle_errors(returncode, stdout, args, kwargs)
  File "grass-7.1.svn/etc/python/grass/script/core.py", line 328, in
handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['v.db.connect',
'--q', '-g', 'map=edit@PERMANENT', 'sep=;'] ended with error
Process ended with non-zero return code 1. See errors in the (error)
output.
ERROR: Unable to drop table <lines>

Hi Radim,

it works for me with NC sample Location for G6 [1]. So, the same as for
Paolo [2]. How can I reproduce it? I've tried vector map without a table,
but it also worked well. Tested with latest 7.0 release branch code.

Vaclav

[1] http://grass.osgeo.org/download/sample-data/
[2] https://lists.osgeo.org/pipermail/grass-dev/2015-October/076648.html