diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index 64665b8bb..cfc496b76 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -436,7 +436,8 @@ class ImportOpenFileContextManager: def __exit__(self, exc_type, exc_value, traceback): if self.filename != '-': - self.filehandle.close() + if self.filehandle: + self.filehandle.close() return False def open_file(self, filename):