-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Expected behavior
If an attribute or key is missing from an attrdict object, it should raise an AttributeError or KeyError on the missing key.
Current behavior
The attrdict class sometimes instead raises an AttributeError on a missing __frozen attribute.
Machines affected
All
To Reproduce
For the global workflow, declare the HOMEgfs environment variable and run setup_xml.py.
Context
Reported many times by users, including here: NOAA-EMC/global-workflow#3161.
Detailed Description
This error is raised by these lines:
Lines 81 to 84 in 3ea5acd
| def __missing__(self, name): | |
| if object.__getattribute__(self, '__frozen'): | |
| raise KeyError(name) | |
| raise KeyError(name) |
Possible Implementation
I see two options: create a __getattr__ method to handle missing attributes or, in the lines above, use hasattr() to first check if __frozen is an attribute of the attrdict object.