Closed lahwaacz closed 9 years ago
The bug should fixed, please test and close.
About _OPTION
, now you can monkey-patch it with:
from configfile import ConfigFile, Section
Section._OPTION = r'^[a-zA-Z_]+[a-zA-Z0-9_-]*$'
conf = ConfigFile("./test.conf")
Fixed indeed, thanks!
The attribute thing is also the reason why argparse converts -
in arg names to _
in dest names. Interestingly the prefix character (-
by default) is configurable, but the conversion is hardcoded to account only for -
. I guess nobody really uses different prefix...
I was thinking of this config:
Unfortunately parsing this with
interpolation=True
(andinherit_options=True
) fails withKeyError: 'cache-dir'
...(Btw. I had to add
-
to theSection._OPTION
regex to support the above keys, which should be solved by #5, but is there a reason why it's not included by default?)