[GRASS-user] use pipe character in a script

Paulo van Breugel p.vanbreugel at gmail.com
Fri Apr 1 01:26:40 PDT 2022


On Wed, Mar 23, 2022 at 8:59 AM Uwe Fischer <gisfisch at t-online.de> wrote:

> Hello,
>
>
>
> I try to fill a certain attribute column with a variable plus a Pipe
> character (|) in a python script:
>
>
>
> value_to_fillin = myvariable + '|'
>
> grass.run_command(‘v.db.update‘, map='mymap', column='mycol',
> value=value_to_fillin)
>

This works for me:

    import grass.script as gs
    valuetofillin = "myvariable{}".format('a')
    gs.run_command('v.db.update', map='aaa', column='aa',
value=valuetofillin)

Btw, make sure to use the right single quotation marks around v.db.update.
In your example, you are using pretty print quotation marks around
v.db.update, so perhaps that is the culprit?



>
>
>
> But it does not work. When I try to place there 'xx' instead of the pipe,
> it works.
>
>
>
> Does the pipe have special meaning in Python or GRASS and therefore is not
> available as normal character? Is there a workaround (because the pipe must
> be there to meet my data transfer requirements)
>
>
>
> Regards, Uwe
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20220401/6a391343/attachment.html>


More information about the grass-user mailing list