Re: a ConfigParser wtf moment

2005-01-13 Thread grahamd
True, wasn't thinking. This will affect get() as well. My problem was a slightly different problem. In your case you would have got what you wanted if get()/items() instead of being implemented as: .try: .value = d[option] .except KeyError: .raise NoOptionE

Re: a ConfigParser wtf moment

2005-01-13 Thread Eric S. Johansson
[EMAIL PROTECTED] wrote: To avoid this, you need to write something like: . list = [] . for key in configuration.options("core"): . list.append((key,configuration.get("core",substitution)) . print list This cause me problems for a different reason, ie., that user vars keys appear in what ite

Re: a ConfigParser wtf moment

2005-01-13 Thread grahamd
Sort of hard to explain, but if you put another: list = configuration.items("core") print list at the end of the script, you will find that the original config hasn't been changed. It is a quirk of how the items() method is implemented using 'yield' that means that you see what you do. In partic

a ConfigParser wtf moment

2005-01-13 Thread Eric S. Johansson
I'm not sure if this is a real problem or if I have been staring at code too long. given this code #!/usr/bin/python from ConfigParser import * configuration_file = "test.conf" substitution = {"xyzzy":"maze"} configuration = SafeConfigParser() configuration.readfp(file(configuration_file)) list