Check input_file attribut

This commit is contained in:
Mark Qvist 2024-01-14 18:57:23 +01:00
parent 8e1e2a9c54
commit a37e039424
1 changed files with 7 additions and 5 deletions

View File

@ -625,11 +625,13 @@ class Resource:
except Exception as e: except Exception as e:
RNS.log("Error while executing resource concluded callback from "+str(self)+". The contained exception was: "+str(e), RNS.LOG_ERROR) RNS.log("Error while executing resource concluded callback from "+str(self)+". The contained exception was: "+str(e), RNS.LOG_ERROR)
finally: finally:
if hasattr(self.input_file, "close") and callable(self.input_file.close): try:
try: if hasattr(self, "input_file"):
self.input_file.close() if hasattr(self.input_file, "close") and callable(self.input_file.close):
except Exception as e: self.input_file.close()
RNS.log("Error while closing resource input file: "+str(e), RNS.LOG_ERROR)
except Exception as e:
RNS.log("Error while closing resource input file: "+str(e), RNS.LOG_ERROR)
else: else:
# Otherwise we'll recursively create the # Otherwise we'll recursively create the
# next segment of the resource # next segment of the resource