configparser shuffles all sections ?

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Fri Jun 22 07:46:32 EDT 2007


On Fri, 22 Jun 2007 09:28:42 +0200, stef wrote:

> hello,
> 
> 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.

Having read the rest of this thread, I think Stef is not worried about
*human* manipulation. There is nothing stopping a human from editing the
INI file in a text editor, except perhaps the sheer size of the file.

But what I think is the actual problem is that, having read the INI file
into dictionaries, the order is lost. For that matter, so are comments,
and probably whitespace. That makes it impractical to generate an INI
file, then read it with configparser, make changes to the configparser
data, then write it back to the INI file.

Unfortunately, I don't think configparser can deal with that, and I'm not
aware of any libraries that will.


-- 
Steven




More information about the Python-list mailing list