config: make sure we create the config file properly
I guess this code was tested with an existing config file only, because I have the following: DEBUG: tuhi.config: E0:61:C6:BF:14:4E: adding new config, uuid 8bbc6be4347a Traceback (most recent call last): File "./tuhi.py", line 153, in _on_uuid_updated self.config.new_device(bluez_device.address, wacom_device.uuid) File "tuhi/tuhi/config.py", line 89, in new_device config['Device']['Address'] = address File "/usr/lib64/python3.6/configparser.py", line 959, in __getitem__ raise KeyError(key) KeyError: 'Device'
This commit is contained in:
parent
fda5d7f132
commit
1b73de68b2
|
@ -86,8 +86,11 @@ class TuhiConfig(GObject.Object):
|
|||
config.optionxform = str
|
||||
config.read(path)
|
||||
|
||||
config['Device']['Address'] = address
|
||||
config['Device']['UUID'] = uuid
|
||||
config['Device'] = {
|
||||
'Address': address,
|
||||
'UUID': uuid,
|
||||
}
|
||||
|
||||
with open(path, 'w') as configfile:
|
||||
config.write(configfile)
|
||||
|
||||
|
|
Loading…
Reference in New Issue