[GRASS-user] Re: Define Global Variables and use them in a Python script

LeeDaniel Lee.Daniel.1986 at gmail.com
Mon Jul 5 12:12:27 EDT 2010


Hi Kim,

I'm no expert, but I'd suggest not reading them into GRASS as global
variables but defining them as global variables within the script in Python.
You could then have Python read the variables from a file and set them
within the environment of the script, like with a config file. Here's some
interesting stuff about reading from files in Python:

http://www.java2s.com/Code/Python/File/File-Read.htm
http://docs.python.org/tutorial/inputoutput.html

Hope that helps! Sorry that I couldn't find a better tutorial, but there's
tons of stuff out there and the stuff I just posted is probably really basic
for you anyway ;)

Best,
Daniel
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Define-Global-Variables-and-use-them-in-a-Python-script-tp5256628p5256687.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list