Opened 10 years ago

Closed 10 years ago

#1534 closed defect (fixed)

vector_db_select fails with kwargs

Reported by: artegion Owned by: grass-dev@…
Priority: minor Milestone: 6.4.2
Component: Python Version: unspecified
Keywords: vector_db_select Cc:
CPU: Unspecified Platform: All

Description

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 ....

Change History (2)

comment:1 by hamish, 10 years ago

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

comment:2 by hamish, 10 years ago

Keywords: vector_db_select added
Priority: criticalminor
Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.