Merge pull request #1563 from croneter/py3-fix-context-manager

Fix errors when PKC tries to edit files that don't exist yet
This commit is contained in:
croneter 2021-07-25 15:25:25 +02:00 committed by GitHub
commit b222df108d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -699,8 +699,7 @@ class XmlKodiSetting(object):
# Document is blank or missing
if self.force_create is False:
LOG.debug('%s does not seem to exist; not creating', self.path)
# This will abort __enter__
self.__exit__(IOError('File not found'), None, None)
raise
# Create topmost xml entry
self.tree = undefused_etree.ElementTree(
undefused_etree.Element(self.top_element))