On 3 Feb 2011, at 16:55, "Johannes Radinger" <jradin...@gmx.at> wrote:

> 
> -------- Original-Nachricht --------
>> Datum: Thu, 3 Feb 2011 16:26:47 +0000
>> Von: Joshua Arnott <j...@snorfalorpagus.net>
>> An: "grass-user@lists.osgeo.org" <grass-user@lists.osgeo.org>
>> Betreff: [GRASS-user] Re: mapcalc problem in python script!!
> 
>> Johannes,
>> 
>> Looking at your Python code and the error, I expect the issue is with the
>> way you are calling the script, rather than it's content.
>> 
>> From the documentation, g.parser returns a Python dictionary. The options
>> "command" is a variable, rather than a function.
>> 
>> http://grass.osgeo.org/grass64/manuals/html64_user/g.parser.html
>> 
>> The key error occurs when you attempt to access a key, in your case
>> upstream_shreve, when it does not exist.
>> 
>> http://wiki.python.org/moin/KeyError
>> 
>> I suspect the problem is that you're not setting a value for
>> upstream_shreve from the command line, i.e.,
>> 
>> ./test3.py upstream_shreve=newmapname upstream_part=upstreammap
>> shreve=anothermap
>> 
>> In your Python script, if you throw in:
>> 
>> print options
>> 
>> You'll be able to quickly check it contains the key-value pairs you
>> expect.
>> 
>> Hope this helps,
>> Josh.
> 
> Hello Josh,
> 
> first thank you for looking over my code...
> 
> Sr but I don't know what you're meaning excactly... the print options command 
> gives me {}... but how should the executable .py file look like?
> 
> /johannes

If {} is all that is returned, it means the dictionary is empty. How are you 
running your Python script? What do you type at the grass command prompt?

Josh._______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to