Message413343
ConfigParser() is not using a custom dictionary class correctly, according to my understanding. I have duplicate options in a config file that I want to rename uniquely. The following code does not work.
x = 0
class MultiDict(dict):
def __setitem__(self, key, value):
if key == 'textsize':
global x
key += str(x)
x += 1
dict.__setitem__(self, key, value)
...
config1 = cp.ConfigParser(dict_type=MultiDict)
config1.read('ini_file.ini')
"textsize" is the option named twice in my config file. When I run the code, I get a DuplicateOptionError for "textsize". No one seems to know how to solve this, so it could be a bug. If it's sloppy coding, I apoligize. |
|
Date |
User |
Action |
Args |
2022-02-16 17:17:23 | malonn | set | recipients:
+ malonn |
2022-02-16 17:17:23 | malonn | set | messageid: <1645031843.76.0.82823546709.issue46770@roundup.psfhosted.org> |
2022-02-16 17:17:23 | malonn | link | issue46770 messages |
2022-02-16 17:17:23 | malonn | create | |
|