-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
When specifying an encoding for a config file with a configspec applying the configspec to copy the default values will change the encoding of the config file.
Here is the python snippet that shows the problem:
from configobj import ConfigObj
from validate import Validator
configspec = '''
version = float
'''.splitlines()
config = ConfigObj(configspec=configspec,
encoding='utf8')
# verify that encoding is set correctly:
print(config.encoding) # will return 'utf8', correct
# apply configspec while copying default values
config.validate(Validator(), copy=True)
# again verify that encoding is set correctly:
print(config.encoding) # will return 'None', incorrectTo get around this you have to create the configspec as a distinct ConfigObject object specifying its encoding and hand it over to the real ConfigObj.