Make all configuration file access consistently text only to avoid
failures when accessed as binary. This fixes errors on writing a
default tuna.conf configuration file and on save of snapshots in
the profile management tab.
Signed-off-by: Federico Pellegrin <fede(a)evolware.org>
---
tuna/config.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tuna/config.py b/tuna/config.py
index 03dc479..5d6848c 100644
--- a/tuna/config.py
+++ b/tuna/config.py
@@ -47,7 +47,7 @@ class Config:
self.temp = configparser.RawConfigParser()
self.temp.read(self.configFile)
self.temp.set('global', 'lastFile', filename)
- with open(self.configFile, 'wb') as cfgfile:
+ with open(self.configFile, 'w') as cfgfile:
self.temp.write(cfgfile)
self.config['lastfile'] = filename
@@ -317,7 +317,7 @@ class Config:
def saveSnapshot(self, data):
tempconfig = configparser.RawConfigParser()
- tempconfig.readfp(io.BytesIO(self.cache))
+ tempconfig.readfp(io.StringIO(self.cache))
snapcat = tempconfig.items('categories')
out = {}
for opt, val in snapcat:
--
2.26.2