Parsing environment variables in ConfigParser files

Matthew Barnes matthew at barnes.net
Fri Dec 19 18:36:11 CET 2003


I'm considering submitting a patch for Python 2.4 to allow environment
variable expansion in ConfigParser files.  The use cases for this
should be obvious.  I'd like to be able to specify something like the
following in a configuration file:

        [section_name]
        data_file=${HOME}/mydata.dat

...(where HOME=/home/matt) and have ConfigParser automatically expand
it to:

        [section_name]
        data_file=/home/matt/mydata.dat

The change is pretty straight-forward, but I'm interested in feedback
on whether this is a good idea, what the syntax for environment
variable references should look like (currently I'm thinking
${varname}), or whether there are any hidden complexities or
backward-compatibility concerns.

Matthew Barnes




More information about the Python-list mailing list