[GRASS-user] Re: mapcalc problem in python script!!

Joshua Arnott josh at snorfalorpagus.net
Thu Feb 3 11:26:47 EST 2011


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20110203/b43297ad/attachment.html


More information about the grass-user mailing list