[GRASS-user] v.in.lines not working in Python script

I get the following error when I use v.in.lines in a Python Script in Windows (sorry):

C:\Program Files\GRASS 6.4.2\scripts\v.in.lines: 126: v.in.mapgen: command not found

My script It’s quite simple:

import grass.script as g
g.run_command(‘v.in.lines’, input=‘points.txt’, output=‘contour’)

And my point.txt file:

-71.20805823448374|-30.59771251456061
-71.20765621447394|-30.59745831224444
-71.20736018153805|-30.59778541778508
-71.20648094588758|-30.59723716721055
-71.20723941992262|-30.59621434252238
-71.20833309148421|-30.59734839427609
-71.20805823448374|-30.59771251456061

Others commands work find (like v.in.ascii)… and v.in.mapgen is in the folder.

Any idea?

Andrés Silva Marambio
Ingeniero Agrónomo, Mención en Gestión Ambiental
Pontificia Universidad Católica de Valparaíso

As I remember you might need to have write “NaN|NaN” after each line in your file. ( I have a python script doing this for a large set of lines). But if you only have one line this might not be your issue…

Have you tried doing it from the command line? (yes, you should work in a linux environment :wink:

Martin


Fra: grass-user-bounces@lists.osgeo.org [grass-user-bounces@lists.osgeo.org] på vegne av Andrés Silva [andres.silva.m@gmail.com]
Sendt: 7. desember 2012 13:05
To: GRASS Users list
Emne: [GRASS-user] v.in.lines not working in Python script

I get the following error when I use v.in.lines in a Python Script in Windows (sorry):

C:\Program Files\GRASS 6.4.2\scripts\v.in.lines: 126: v.in.mapgen: command not found

My script It’s quite simple:

import grass.script as g
g.run_command(‘v.in.lines’, input=‘points.txt’, output=‘contour’)

And my point.txt file:

-71.20805823448374|-30.59771251456061
-71.20765621447394|-30.59745831224444
-71.20736018153805|-30.59778541778508
-71.20648094588758|-30.59723716721055
-71.20723941992262|-30.59621434252238
-71.20833309148421|-30.59734839427609
-71.20805823448374|-30.59771251456061

Others commands work find (like v.in.ascii)… and v.in.mapgen is in the folder.

Any idea?

Andrés Silva Marambio
Ingeniero Agrónomo, Mención en Gestión Ambiental
Pontificia Universidad Católica de Valparaíso

Writing “NaN|NaN” after each line doesn’t solve the problem =( … v.in.lines work from the command line:

v.in.lines input=C:\Users\usuario\Documents\Dropbox\Agriluk\script\temp.txt output=lineacomando
which: tac: unknown command
Importing with v.in.ascii …
Error en las descripciónes, no existe la opción ‘punto’ en .
Error en las descripciónes, no existe la opción ‘estándar’ en .
Construyendo topología para el mapa vectorial …
Registrando elementos…
1 Elementos registrados.
7 vertices registrados.
Construyendo áreas.
0 áreas construidas.
0 Islas construidas.
Adjuntando islas…
Adjuntando centróides…
Número de nodos: 1.
Número de primitivas: 1.
Número de puntos: 0.
Número de líneas: 1.
Número de contornos: 0.
Número de centroides (baricentros): 0.
Número de áreas: 0.
Número de íslas: 0.
v.in.ascii completo.
“lineacomando@PERMANENT” successfully created.
(Fri Dec 07 11:03:05 2012) Comando finalizado. (2 sec)

In Linux work perfect, the problem is Windows… as always… regrettably I need to make this script in Windows…

···

Andrés Silva Marambio
Ingeniero Agrónomo, Mención en Gestión Ambiental
Pontificia Universidad Católica de Valparaíso

On Fri, Dec 7, 2012 at 10:51 AM, Martin Album Ytre-Eide <Martin.Album.Ytre-Eide@nrpa.no> wrote:

As I remember you might need to have write “NaN|NaN” after each line in your file. ( I have a python script doing this for a large set of lines). But if you only have one line this might not be your issue…

Have you tried doing it from the command line? (yes, you should work in a linux environment :wink:

Martin


Fra: grass-user-bounces@lists.osgeo.org [grass-user-bounces@lists.osgeo.org] på vegne av Andrés Silva [andres.silva.m@gmail.com]
Sendt: 7. desember 2012 13:05
To: GRASS Users list
Emne: [GRASS-user] v.in.lines not working in Python script

I get the following error when I use v.in.lines in a Python Script in Windows (sorry):

C:\Program Files\GRASS 6.4.2\scripts\v.in.lines: 126: v.in.mapgen: command not found

My script It’s quite simple:

import grass.script as g
g.run_command(‘v.in.lines’, input=‘points.txt’, output=‘contour’)

And my point.txt file:

-71.20805823448374|-30.59771251456061
-71.20765621447394|-30.59745831224444
-71.20736018153805|-30.59778541778508
-71.20648094588758|-30.59723716721055
-71.20723941992262|-30.59621434252238
-71.20833309148421|-30.59734839427609
-71.20805823448374|-30.59771251456061

Others commands work find (like v.in.ascii)… and v.in.mapgen is in the folder.

Any idea?

Andrés Silva Marambio
Ingeniero Agrónomo, Mención en Gestión Ambiental
Pontificia Universidad Católica de Valparaíso

On Fri, Dec 7, 2012 at 3:13 PM, Andrés Silva <andres.silva.m@gmail.com> wrote:

Writing "NaN|NaN" after each line doesn't solve the problem =( ...
v.in.lines work from the command line:

v.in.lines input=C:\Users\usuario\Documents\Dropbox\Agriluk\script\temp.txt
output=lineacomando
which: tac: unknown command

--> the "tac" program is used by v.in.mapgen which is called by v.in.lines.

Importing with v.in.ascii ...
Error en las descripciónes, no existe la opción 'punto' en <format>.
Error en las descripciónes, no existe la opción 'estándar' en <format>.

--> Second problem: somewhere the "point" type has been translated
as well as "standard" format. I do not find that in the "po" files which
contain the translated messages. The GRASS parser would understand
this when in English but somewhere it got illegally translated.

Markus