On Mon, Mar 14, 2011 at 11:25 AM, Alexander Schatten <asch...@gmail.com>wrote:
> They don't. Hm, ok, I am always for best practices. If there is a > better way to do it I am open for suggestions ;-) How would the best > practice be to load configuration data from a file. > > I mean, this is something very common: you write a program or a script > and want to load some configuration data. > 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). Examples: ~/.bashrc, ~/.vimrc, ~/.bash_profile, ~/.cshrc, etc. 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 os.environ['HOME'] or os.getenv('HOME') All the best, Jason -- Jason M. Swails Quantum Theory Project, University of Florida Ph.D. Candidate 352-392-4032
-- http://mail.python.org/mailman/listinfo/python-list