[GRASS-user] Problem with Python Scripts and grass.script
(GRASS 6.5SVN) on Mac
JRadinger at gmx.at
Tue Mar 29 14:14:07 EDT 2011
The script I am trying is the simpliest form of a script calling just one
function of GRASS (e.g. mapcalc or r.thin),
attached you can find that script which can be applied e.g. on the spearfish
rasterdataset...and in my opinion it is correct and in the correct order
of commands as mentioned in the grass-wiki and with the correct line endings.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1064 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20110329/77da025e/testscript.bin
-------------- next part --------------
Am 29.03.2011 um 17:38 schrieb Michael Barton:
> It looks like it it is going to the GRASS commmand before you push the run button. So I think you have the commands in the wrong place in the script.
> Trying grabbing a python script out of the scripts directory in GRASS 7. Since those all work, you should be able to modify it bit by bit to transform it to yours.
> C. Michael Barton
> Director, Center for Social Dynamics & Complexity
> Professor of Anthropology, School of Human Evolution & Social Change
> Arizona State University
> voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
> fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
> On Mar 29, 2011, at 8:35 AM, Johannes Radinger wrote:
>> Hello Michael,
>> thank you for your answer and your tip with the debugging code,
>> but it doesn't matter where I put it, I fail. I that case grass doesn't
>> open anymore the interactive menu (from g.parser) for that script and I just get the error:
>> my program gets this far
>> ERROR: Required parameter <newmap> not set:
>> ERROR: Required parameter <elevation> not set:
>> (input 1)
>> ERROR: Required parameter <geology> not set:
>> (input 2)
>> if I leave the debugging code out, the interactive menu pops up and I can set the parameters, but nothing is afterwards processed.
>> what am I doing wrong?
>> -------- Original-Nachricht --------
>>> Datum: Tue, 29 Mar 2011 07:40:28 -0700
>>> Von: Michael Barton <Michael.Barton at asu.edu>
>>> An: grass-user grass-user <grass-user at lists.osgeo.org>, Johannes Radinger <JRadinger at gmx.at>
>>> Betreff: [GRASS-user] Problem with Python Scripts and grass.script (GRASS 6.5SVN) on Mac
>>> Hi Johannes,
>>> Sorry I couldn't get back to you sooner. But it seems like others have
>>> told you about the line ending issue. That's a real problem because most
>>> people (myself included) will want to start out by copying an example program
>>> from the GRASS site.
>>> ...and it will utterly fail to run.
>>> Anyway, now that your got it started, it is a debugging issue. Put in some
>>> debugging code like...
>>> print 'my program gets this far'
>>> ...at different places to see where it is getting stuck. This is tedious
>>> but always seems needed.
>>> C. Michael Barton
>>> Director, Center for Social Dynamics & Complexity
>>> Professor of Anthropology, School of Human Evolution & Social Change
>>> Arizona State University
>>> voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
>>> fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
>>> www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
>>> On Mar 29, 2011, at 3:25 AM, <grass-user-request at lists.osgeo.org> wrote:
>>>> Date: Tue, 29 Mar 2011 11:11:12 +0200
>>>> From: "Johannes Radinger" <JRadinger at gmx.at>
>>>> Subject: [GRASS-user] Problem with Python Scripts and grass.script
>>>> (GRASS 6.5SVN) on Mac
>>>> To: grass-user at lists.osgeo.org
>>>> Message-ID: <20110329091112.282590 at gmx.net>
>>>> Content-Type: text/plain; charset="utf-8"
>>>> Hello Grass users!
>>>> I am working with GRASS 6.5 SVN (r45714, last weeks source) and try to
>>> run Python Scripts. After I solved the problem with the line endings, GRASS
>>> seems to be able to read my scripts (via launch script...). At least the
>>> interactive interface pops up correctly (it seems g.parser can read all my
>>> options etc.), but after executing it nothing happens and nothing is
>>> processed. I tried it with mapcalc but also with r.thin (one input, one output, so
>>> very simple).
>>>> I don't know what is the problem or how can I check what the problem
>>>> ...what I've tried already and which may cause the problem is that I
>>> cannot import grass.script (import grass.script) in the Terminal (pyhton)
>>> and/or IDLE... it says: module not found...
>>>> Just for your information I run GRASS on a Apple Mac Snow Leopard
>>>> with Python 2.6.6.
>>>> NEU: FreePhone - kostenlos mobil telefonieren und surfen!
>>>> Jetzt informieren: http://www.gmx.net/de/go/freephone
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org
>> GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
>> gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
More information about the grass-user