Open RonHildebrandt opened 3 weeks ago
I don't quite understand how "self.extensions.get(extension, lambda _: {})(file_path)"
can be None. That can only happen if the the function that is defined for that extension returns None
, becaus if the extension is not in self.extensions
, the statement above use the lambda function that always returns an empty dict. So when exactly does this happen?
This issue was related to "I have no Idea what I'm doing exactly" - Yea, I forgot to rename a function in my Multiformat reader, and was wondering about this. (i.e. I set for a specific file type a specific definiton to handle this file, but I forgot to define it (or in my case, i did not rename both definitions)). NOt sure if you want to catch this case.
Think you can judge this better if it is necessary. Usually, this error should not occur
I had the problem that, I renamed a function and forgot it at another position. This was the case, as the name in:
self.extensions = {".yml": self.handle_eln_file} was different from the defined in the new created MultiformatReader.
Therefore: "self.extensions.get(extension, lambda _: {})(file_path)" was None and then failed in updateing the template. Not sure if this is needed to catch this case (should be avoidable if you know what you do).