[GRASS-dev] [GRASS GIS] #1534: vector_db_select fails with kwargs

#1534: vector_db_select fails with kwargs
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: Python | Version: unspecified
Keywords: | Platform: All
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
in lib/python/vector.py, at line 205, fs option makes trouble if kwargs is
not None

>00202 ret = read_command('v.db.select',

>00203 map = map,

>00204 layer = layer,

>00205 fs = '|', **kwargs)

i.e. grass.vector_select('lakes', where='cat in (1,2,3,4,5)')
because start_command transforms | character into shell pipe

""where=cat in (1,3,4,5)"" non è riconosciuto come comando interno o
esterno,
  un programma eseguibile o un file batch.
ERRORE: vector_select() failed

possible solutions:
1) fs=| is default option in v.db.select so

00202 ret = read_command('v.db.select',
00203 map = map,
00204 layer = layer,
00205 **kwargs) # fs = '|', removed

will work

2) change | with another character ....

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

#1534: vector_db_select fails with kwargs
-------------------------+--------------------------------------------------
Reporter: artegion | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.2
Component: Python | Version: unspecified
Keywords: | Platform: All
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by hamish):

patch as suggested in summary:
{{{
Index: releasebranch_6_4/lib/python/vector.py

--- releasebranch_6_4/lib/python/vector.py (revision 50829)
+++ releasebranch_6_4/lib/python/vector.py (working copy)
@@ -202,7 +202,7 @@
      ret = read_command('v.db.select',
                         map = map,
                         layer = layer,
- fs = '|', **kwargs)
+ **kwargs)

      if not ret:
          error(_('vector_select() failed'))
}}}

Hamish

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

#1534: vector_db_select fails with kwargs
-----------------------+----------------------------------------------------
  Reporter: artegion | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: minor | Milestone: 6.4.2
Component: Python | Version: unspecified
Resolution: fixed | Keywords: vector_db_select
  Platform: All | Cpu: Unspecified
-----------------------+----------------------------------------------------
Changes (by hamish):

  * keywords: => vector_db_select
  * priority: critical => minor
  * status: new => closed
  * resolution: => fixed

Comment:

committed in all branches. a general solution dealing with the root cause
would be interesting to learn about, but is not needed in this particular
case.

AFAICT the function is not used by any of the core grass scripts AFAICT,
so lowering priority.

Hamish

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