Paul D.Smith enlightened us with: > The background is that I've inherited some historical Python scripts > that need to be configured from a bash shell script [...] instead of > the existing Pything config script. [...] The problem is that this > config file is almost certainly not complete [...] and I don't want > to spend my life tweaking not one config file (the shell script), > but two (the shell script and the Python script).
So basically you want environment variables to be able to alter Python variables. This is not a smart move. It's the same as the 'register_globals' functionality in PHP. Read http://us2.php.net/register_globals for more information. > 2. A simple Python config which searches for all shell environment > variables named "MY_..." and instantiates then as Python variables. Why don't you just copy all MY_... environment variables from os.environ to the dict which holds your configuration? Or are you storing your entire configuration in global variables? A dict would be a much cleaner and more extendible solution. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? Frank Zappa -- http://mail.python.org/mailman/listinfo/python-list