Fix PKC crashing due to a restricted Python environment

This commit is contained in:
croneter 2018-11-26 15:44:12 +01:00
parent 6219ba6834
commit bd2c467183
2 changed files with 16 additions and 1 deletions

View file

@ -410,6 +410,10 @@ msgctxt "#30416"
msgid "Settings for the Plex Server"
msgstr ""
msgctxt "#30417"
msgid "Could not change the Kodi settings file {0}. PKC might not work correctly. Error: {1}"
msgstr ""
# PKC Settings - Connection
msgctxt "#30500"
msgid "Verify Host SSL Certificate (more secure)"

View file

@ -682,7 +682,18 @@ class XmlKodiSetting(object):
# Indent and make readable
indent(self.root)
# Safe the changed xml
try:
self.tree.write(self.path, encoding='utf-8')
except IOError as err:
LOG.error('Could not save xml %s. Error: %s',
self.filename, err)
# Could not change the Kodi settings file {0}. PKC might not
# work correctly. Error: {1}
if not settings('%s_ioerror' % self.filename):
messageDialog(lang(29999),
lang(30417).format(self.filename, err))
settings('%s_ioerror' % self.filename,
value='warning_shown')
def _is_empty(self, element, empty_elements):
empty = True