[New-bugs-announce] [issue4645] configparser DEFAULT

Shawn Ashlee report at bugs.python.org
Fri Dec 12 21:10:16 CET 2008


New submission from Shawn Ashlee <shawn.ashlee at rackspace.com>:

using .add_section() and .set() for the DEFAULT section adds it twice:

[user at srv ~]$ cat test_configparser.py 
#!/usr/bin/env python

import ConfigParser

a = ConfigParser.SafeConfigParser()

# borked
a.add_section('DEFAULT')
a.set('DEFAULT', 'foo', 'bar')

# working
a.add_section('working')
a.set('working', 'foo', 'bar')

b = open('testing', 'w')
a.write(b)
b.close()

[user at srv ~]$ python test_configparser.py 
[user at srv ~]$ cat testing 
[DEFAULT]
foo = bar

[DEFAULT]

[working]
foo = bar


Tested with 2.4 and 2.5, py3k no longer allows DEFAULT to be passed, so
this is a python < 3k issue.

----------
components: Extension Modules
messages: 77686
nosy: shawn.ashlee
severity: normal
status: open
title: configparser DEFAULT
versions: Python 2.4, Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4645>
_______________________________________


More information about the New-bugs-announce mailing list