<div>Hello Glynn</div>
<div> </div>
<div>As soon as I arrive to the office I will give it a try. Thought that I could have global variables such as LC_LANGUAGES and other GRASS_GLOBAL VARIABLES. Is it possible to define them in Init.sh (or .bat) and be used in Python Scripts?</div>

<div> </div>
<div>Best regards,</div>
<div>Kim<br></div>
<div class="gmail_quote">2010/7/5 Glynn Clements <span dir="ltr">&lt;<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>&gt;</span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div></div>
<div><br>Kim Besson wrote:<br><br>&gt; I&#39;ve been testing and &quot;kind of &quot; using GRASS-Python scripts for nearly 2<br>&gt; weeks and it&#39;s being great. So far no major issues but now I need to do<br>&gt; something:<br>
&gt; - From a text file (ASCII) I need to read a few variables and make them<br>&gt; global bariables I mean, be available and defined for a huge set of Scripts<br>&gt; in order to avoid to define those variables in each Script. And, in case I<br>
&gt; change them, I only have to change in that ASCII File. My questions are:<br>&gt; 1- How can I do GRASS to read an external File in order to define GLOBAL<br>&gt; VARIABLES?<br>&gt; 2- How can I call them from a GRASS_SCRIPT?<br>
<br></div></div>A &quot;global&quot; variable in Python is local to the module in which it&#39;s<br>defined. So you you have a module named config, to access any global<br>variables in that module from other modules you would need either<br>
&quot;import config&quot; (in which case, variables will be accessible as<br>config.whatever) or &quot;from config import *&quot; (but as the program grows,<br>the chances of name collisions increase).<br><br>For a set of related variables, e.g. configuration parameters, it&#39;s<br>
usually better to make them all members of a specific object, e.g.:<br><br>       class Params(object):<br>           def __init__(self, filename):<br>               # initialise members from file<br><br>       # read the config file<br>
       params = Params(&quot;config.cfg&quot;)<br><br>Then you only need to import a single name:<br><br>       from config import params<br><font color="#888888"><br>--<br>Glynn Clements &lt;<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>&gt;<br>
</font></blockquote></div><br>