[GRASS-user] Use of v.in.ascii in python with stdin

Hamish hamish_b at yahoo.com
Mon Jun 17 14:06:00 PDT 2013


>So I tried without:


>
>ascii = """cat,X,Y,Name
>1,10:20:08E,53:25:27N,mypoint"""
>
>cols = 'cat int, x varchar(10), y varchar(10), name varchar(10)'
>
>grass.write_command("v.in.ascii",
>        overwrite=True,
>        format="point",
>        #flags="n",
>        input="-",
>        cat=1,
>        x=2,
>        y=3,
>        stdin=ascii,
>        columns=cols,
>        output="mypoint",
>        separator=",")
>
>which at least executes but gives me following error:
> GRASS_INFO_ERROR(13239,2): Unparsable longitude
>value in column num 2: X


you need skip=1 or put a # in front of the first line, it's trying
to parse the header line.


style: since the stdin= option is a virtual one for
grass.write_command(), consider putting it last.


Hamish



More information about the grass-user mailing list