On 1/31/06, Tony Meyer <[EMAIL PROTECTED]> wrote:
> Why doesn't this work? It does here:
>
> $ cat suite.ini
> [sect]
> opt1 = 1
> opt2 = 2
> $ cat app.ini
> [sect]
> opt1 = 3
> opt4 = 5
> $ python
> Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import ConfigParser
> >>> c = ConfigParser.ConfigParser()
> >>> c.read(("suite.ini", "app.ini"))
> ['suite.ini', 'app.ini']
> >>> c.sections()
> ['sect']
> >>> c.options("sect")
> ['opt4', 'opt2', 'opt1']
> >>> c.get("sect", "opt1")
> '3'
>
> Or do you mean something else?
Err. Because I missed the fact that read() method takes multiple
filenames? There's even a specific explanation of how to load defaults
and then override them with optional files.
I don't know how I missed that. Thanks for pointing it out.
(The whole day's been like that - I'm not sure why I get out of bed
sometimes....:-)
Paul.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com