save_variables: Import ConfigParser as configparser for better Python3 support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
dac0fba50d
commit
0e9cb2abac
|
@ -4,7 +4,7 @@
|
|||
# Copyright (C) 2016-2020 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import os, logging, ast, ConfigParser
|
||||
import os, logging, ast, ConfigParser as configparser
|
||||
|
||||
class SaveVariables:
|
||||
def __init__(self, config):
|
||||
|
@ -20,7 +20,7 @@ class SaveVariables:
|
|||
desc=self.cmd_SAVE_VARIABLE_help)
|
||||
def loadVariables(self):
|
||||
allvars = {}
|
||||
varfile = ConfigParser.ConfigParser()
|
||||
varfile = configparser.ConfigParser()
|
||||
try:
|
||||
varfile.read(self.filename)
|
||||
if varfile.has_section('Variables'):
|
||||
|
@ -42,7 +42,7 @@ class SaveVariables:
|
|||
newvars = dict(self.allVariables)
|
||||
newvars[varname] = value
|
||||
# Write file
|
||||
varfile = ConfigParser.ConfigParser()
|
||||
varfile = configparser.ConfigParser()
|
||||
varfile.add_section('Variables')
|
||||
for name, val in sorted(newvars.items()):
|
||||
varfile.set('Variables', name, repr(val))
|
||||
|
|
Loading…
Reference in New Issue