[GRASS-user] Python placeholder (%d) in stdin statement of db.execute

Johannes Radinger johannesradinger at gmail.com
Wed Apr 10 04:27:09 PDT 2013


Hi,

I am just struggling with a code line. I want to assign a value to all cells
of a defined column. Thus I try to run in python:

probvalue=100.0
grass.write_command("db.execute",stdin = "UPDATE my_points SET prob=%d"
%(probvalue))

So far I checked that the string for stdin is generated correctly:
>>>"UPDATE my_points SET prob=%d" %(probvalue)
UPDATE my_points SET prob=100

However the column is not updated. When executing the sql line directly in
db.execute (GUI) everything works and the column shows 100 for all rows.

Any hints?

I have tried this on GRASS 7, Ubuntu, Python 2.7.3

/Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130410/b018406f/attachment.html>


More information about the grass-user mailing list