<font color="#000000"><br></font><br><div class="gmail_quote">On Mon, Mar 14, 2011 at 11:25 AM, Alexander Schatten <span dir="ltr"><<a href="mailto:aschatt@gmail.com">aschatt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
They don't. Hm, ok, I am always for best practices. If there is a<br>
better way to do it I am open for suggestions ;-) How would the best<br>
practice be to load configuration data from a file.<br>
<br>
I mean, this is something very common: you write a program or a script<br>
and want to load some configuration data.<br></blockquote><div><br>For *nix, many utilities publish conf files in the user's home directory in some sort of .conf file.  That makes it easy to give each user their own .conf file (if multiple users will use it), and avoids any kind of permission issues that arise if your script is in a folder whose write positions are turned off.  It's also where common resource files are loaded (same kind of idea).<br>
<br>Examples: ~/.bashrc, ~/.vimrc, ~/.bash_profile, ~/.cshrc, etc.<br><br>Alternatives are hard-coding the install directory location as part of the install process, which is done sometimes as well.  This is easily accessible from python via<br>
<br>os.environ['HOME']<br><br>or<br><br>os.getenv('HOME')<br><br>All the best,<br>Jason<br></div></div><br>-- <br>Jason M. Swails<br>Quantum Theory Project,<br>University of Florida<br>Ph.D. Candidate<br>352-392-4032<br>