Opened 7 years ago

Closed 3 years ago

#1574 closed defect (wontfix)

WXGUI Launch script: "output already exists"

Reported by: jradinger Owned by: grass-dev@…
Priority: normal Milestone: 7.0.5
Component: wxGUI Version: svn-trunk
Keywords: wxgui, script, python Cc:
CPU: All Platform: MSWindows Vista

Description

When I try to launch a python script via File -> lauch Script that calls v.to.rast in loop, I get the error that the raster file already exists. This is although no such raster exists before running the script (deleted before with g.remove and cross checked with g.list)

I attached a sample script for the North Carolina dataset also including g.list command and time.sleep()... This was also reproduced by Moritz Lennert. His comment on this:

"This is a bit over my head as I don't have a good view of how the GUI works (CC to Martin), but AFAICT the script is run through RunCmd? on line 599 in gui/wxpython/gui_core/goutput.py [1]. So it quite definitely seems a wxgui problem, but I don't know how to go further with this... [1] http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py#L599 _"

Attachments (1)

test.py (641 bytes) - added by jradinger 7 years ago.
Test_script to launch from the GUI

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by jradinger

Attachment: test.py added

Test_script to launch from the GUI

comment:1 in reply to:  description ; Changed 7 years ago by mlennert

CPU: OSX/IntelAll
Keywords: wxgui script added
Platform: MacOSXAll
Summary: v.to.rast in python loop: Error raster already existsWXGUI Launch script: "output already exists"

Replying to jradinger:

When I try to launch a python script via File -> lauch Script that calls v.to.rast in loop, I get the error that the raster file already exists.

After a bit of testing I can confirm the error, but it seems that this is neither linked to a for loop, nor to the fact that this is a python script. I tried both python and bash scripts with simple operations such as v.to.rast, r.to.vect and v.select and they all failed with the message that the output exists, although I always run

g.mremove rast="*" vect="*" -f

before running the script.

I've tried with very simple scripts not invoking the parser (i.e. just one-line bash scripts) and get the same message.

So, it seems that the GUI tries to run the GRASS commands within the script twice. The first time it works as foreseen, the second time it logically bails out with the message that the output already exists. The rest of the script is only run once (at least any print or echo statements only show up once).

On the command line all these script work perfectly. Calling the script directly from the GUI command prompt also leads to the same error message.

This happens to every GRASS command in the script, i.e.:

#! /bin/bash

echo "running script"
r.to.vect input=myroads output=myroads
v.select ainput=roadsmajor binput=censusblk_swwake output=selected_roads operator=within

gives me two error messages about myroads and selected_roads already existing, but both commands ran fine and I have the expected results.

Moritz

comment:2 Changed 7 years ago by mlennert

Version: svn-develbranch6svn-trunk

Just checked and this is present in trunk, 6.5 and 6.4 release branch.

comment:3 in reply to:  1 ; Changed 5 years ago by adamGIS89

Keywords: python added
Milestone: 6.5.07.0.0
Platform: AllMSWindows Vista

This seems to exist in grass 7.0 beta as well. I ran a python script this morning and it told me that most of my output files already existed. The code still delivered mostly right results.

An example: r.to.vect complete. ERROR: option <output>: <xKM_585_590RNV> exists. Extracting areas...

comment:4 in reply to:  3 Changed 5 years ago by annakrat

Replying to adamGIS89:

This seems to exist in grass 7.0 beta as well. I ran a python script this morning and it told me that most of my output files already existed. The code still delivered mostly right results.

An example: r.to.vect complete. ERROR: option <output>: <xKM_585_590RNV> exists. Extracting areas...

Tested trunk with Windows 8 and Ubuntu, I don't have any problems like that. It seems to run only once.

comment:5 Changed 3 years ago by martinl

Milestone: 7.0.07.0.5

comment:6 Changed 3 years ago by martinl

Resolution: wontfix
Status: newclosed

Closing, feel free to reopen if needed.

Note: See TracTickets for help on using tickets.