From 32fd32332a8223bb7d831c082057d5f1a7f7a193 Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Tue, 12 Nov 2024 10:46:38 -0500 Subject: [PATCH] fix: raise AttributeError instead of returning None on __getattr__ (#329) The` __getattr__` method should always raise an `AttributeError` if the value does not exist instead of returning `None`. The existing implementation causes issues when converting to a Pandas `DataFrame`. This error was introduced in the 0.5.0 release. --- src/posit/connect/resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posit/connect/resources.py b/src/posit/connect/resources.py index 49e4b657..bfef8365 100644 --- a/src/posit/connect/resources.py +++ b/src/posit/connect/resources.py @@ -45,7 +45,7 @@ def __getattr__(self, name): stacklevel=2, ) return self[name] - return None + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") def update(self, *args, **kwargs): super().update(*args, **kwargs)