Skip to content

Commit 961db65

Browse files
authored
fix uninitialized property (#6)
When the robot is idle, parked at the base, and I call `kh.get_device_properties(dev)`, I get back the following backtrace (after removing some asyncio layers due to awaits): ``` File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/dataclasses.py", line 240, in wrapper result = user_function(self) ^^^^^^^^^^^^^^^^^^^ File "<string>", line 3, in __repr__ AttributeError: 'DeviceProperties' object has no attribute 'net_status'. Did you mean: 'net_stauts'? ``` What's particularly funny is that when run as `python -m asyncio`, to get the `await` working in the REPL, the exception does not contain that useful hint, and it looks like the following instead: ``` >>> kh.get_device_properties(d[0]) Traceback (most recent call last): File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/asyncio/__main__.py", line 34, in callback coro = func() ^^^^^^ File "<console>", line 1, in <module> File "/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/lib/python3.11/dataclasses.py", line 240, in wrapper result = user_function(self) ^^^^^^^^^^^^^^^^^^^ File "<string>", line 3, in __repr__ AttributeError: 'DeviceProperties' object has no attribute 'net_status' ``` Anyway, the root cause was just a typo in `DeviceProperties.__init__`. Fixes: e0065b6
1 parent 9e2c1ec commit 961db65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

karcher/device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class DeviceProperties:
140140

141141
def __init__(self, **kwargs):
142142
setattr(self, 'cur_path', [])
143-
setattr(self, 'net_stauts', DevicePropertiesNetwork())
143+
setattr(self, 'net_status', DevicePropertiesNetwork())
144144
setattr(self, 'order_total', DevicePropertiesOrderTotal())
145145
setattr(self, 'privacy', DevicePropertiesPrivacy())
146146
setattr(self, 'quiet_status', DevicePropertiesQuiet())

0 commit comments

Comments
 (0)