diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 42c2bc57..16d68884 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -288,11 +288,16 @@ class NodeChunk(BaseObject): self.statusFileLastModTime = -1 self._status.reset() else: - with open(statusFile, 'r') as jsonFile: - statusData = json.load(jsonFile) - self._status.fromDict(statusData) - self.statusFileLastModTime = os.path.getmtime(statusFile) - if oldStatus != self._status.status: + try: + with open(statusFile, 'r') as jsonFile: + statusData = json.load(jsonFile) + self.status.fromDict(statusData) + self.statusFileLastModTime = os.path.getmtime(statusFile) + except Exception as e: + self.statusFileLastModTime = -1 + self.status.reset() + + if oldStatus != self.status.status: self.statusChanged.emit() @property @@ -323,8 +328,11 @@ class NodeChunk(BaseObject): data = self._status.toDict() statusFilepath = self.statusFile folder = os.path.dirname(statusFilepath) - if not os.path.exists(folder): + try: os.makedirs(folder) + except Exception as e: + pass + statusFilepathWriting = getWritingFilepath(statusFilepath) with open(statusFilepathWriting, 'w') as jsonFile: json.dump(data, jsonFile, indent=4)