On Jun 23, 1:14 am, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Jun 22, 8:28 pm, Stef Mientki <[EMAIL PROTECTED]> > wrote: > > > > > Nick Craig-Wood wrote: > > > stef <[EMAIL PROTECTED]> wrote: > > >> I just used configparser for the first time and discovered that it > > >> shuffled all my sections, > > >> and the contents of the sections too. > > > >> This makes human manipulation of the file impossible. > > > >> Is there a way to prevent this shuffling, > > > > You could try getting yourself an ordered dictionary implmentation, > > > say > > > > http://www.voidspace.org.uk/python/odict.html > > > > Then doing something like this (untested) > > > > class MyConfigParser(SafeConfigParser): > > > def __init__(self, defaults=None): > > > SafeConfigParser.__init__(defaults) > > > self._sections = odict() > > > self._defaults = odict() > > > This might be good alternative, > > I'll check that. > > > thank you all for the answers, > > it's always good to know that I've not missed the simple solution ;-) > > There's one simple solution - ConfigObj. > > It is a config file reader and preserves order: > > http://www.voidspace.org.uk/python/configobj.html > > Fuzzyman
Oh - and as a bonus, it preserves comments. http://www.ironpython.info > > > > > cheers, > > Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list