[GRASS-dev] [GRASS-SVN] r63958 - grass/trunk/scripts/v.to.lines

On Mon, Jan 5, 2015 at 9:36 PM, <svn_grass@osgeo.org> wrote:

Author: hellik
Date: 2015-01-05 12:36:58 -0800 (Mon, 05 Jan 2015)
New Revision: 63958

Modified:
   grass/trunk/scripts/v.to.lines/v.to.lines.py
Log:
v.to.lines: strip mapset

Modified: grass/trunk/scripts/v.to.lines/v.to.lines.py

--- grass/trunk/scripts/v.to.lines/v.to.lines.py 2015-01-05 19:32:08 UTC (rev 63957)
+++ grass/trunk/scripts/v.to.lines/v.to.lines.py 2015-01-05 20:36:58 UTC (rev 63958)
@@ -47,7 +47,7 @@

def main():
     # Get the options
- input = options["input"]
+ input = options["input"].split('@')[0]
     output = options["output"]
     method = options["method"]
     min_cat = None

Hi Helli,

why is this needed? In most Python scripts I haven't seen it.
If the same map name exists in different mapsets in the SEARCH_PATH,
how would it pick the selected one?

thanks for hints,
Markus

On Tue, Jan 6, 2015 at 3:10 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Mon, Jan 5, 2015 at 9:36 PM, <svn_grass@osgeo.org> wrote:
>
> Author: hellik
> Date: 2015-01-05 12:36:58 -0800 (Mon, 05 Jan 2015)
> New Revision: 63958
>
> Modified:
> grass/trunk/scripts/v.to.lines/v.to.lines.py
> Log:
> v.to.lines: strip mapset
>
> Modified: grass/trunk/scripts/v.to.lines/v.to.lines.py
> ===================================================================
> --- grass/trunk/scripts/v.to.lines/v.to.lines.py 2015-01-05
19:32:08 UTC (rev 63957)
> +++ grass/trunk/scripts/v.to.lines/v.to.lines.py 2015-01-05
20:36:58 UTC (rev 63958)
> @@ -47,7 +47,7 @@
>
> def main():
> # Get the options
> - input = options["input"]
> + input = options["input"].split('@')[0]
> output = options["output"]
> method = options["method"]
> min_cat = None

Hi Helli,

why is this needed? In most Python scripts I haven't seen it.
If the same map name exists in different mapsets in the SEARCH_PATH,
how would it pick the selected one?

yes, it shouldn't be there like this. The motivation is probably that the
input map name is used to construct temporary map names, so you want to
avoid the mapset part there. But the mapset must be propagated into the
called modules when it is an input map. I hopefully fixed that in
http://trac.osgeo.org/grass/changeset/63965 and backported but I didn't
really tested it.

Anna

thanks for hints,
Markus
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

hi Anna,

The motivation is probably that the input map name is used to construct
temporary map names,
so you want to avoid the mapset part there.

yes, that's the point; tested with winGRASS:

--------------
v.to.lines --verbose input=geodetic_pts@PERMANENT output=geodetic_pts_lines
Processing point data (29939 points found)...
WARNING: Unable to create vector map:
<geodetic_pts@PERMANENT_point_tmp_4724> is not in the current mapset (user1)
ERROR: Kann die Vektorkarte <geodetic_pts@PERMANENT_point_tmp_4724> nicht
erzeugen.
Traceback (most recent call last):
  File
"C:\OSGeo4W\apps\grass\grass-7.1.svn/scripts/v.to.lines.py",
line 170, in <module>
    main()
  File
"C:\OSGeo4W\apps\grass\grass-7.1.svn/scripts/v.to.lines.py",
line 78, in main
    output=out_temp, quiet=quiet)
  File "C:\OSGeo4W\apps\grass\grass-7.1.svn\etc\python\grass
\script\core.py", line 375, in run_command
    return handle_errors(returncode, returncode, args,
kwargs)
  File "C:\OSGeo4W\apps\grass\grass-7.1.svn\etc\python\grass
\script\core.py", line 310, in handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None
['v.delaunay', 'input=geodetic_pts@PERMANENT', 'layer=1',
'output=geodetic_pts@PERMANENT_point_tmp_4724'] ended with
error
Process ended with non-zero return code 1. See errors in the
(error) output.
(Tue Jan 06 16:59:15 2015) Befehl ausgeführt (2 Sek)
--------------

I hopefully fixed that in http://trac.osgeo.org/grass/changeset/63965 and
backported
but I didn't really tested it.

thanks for fixing

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Re-GRASS-SVN-r63958-grass-trunk-scripts-v-to-lines-tp5180152p5180207.html
Sent from the Grass - Dev mailing list archive at Nabble.com.