-
-
Notifications
You must be signed in to change notification settings - Fork 238
Open
mash-graz/python-kasa
#1Labels
bugSomething isn't workingSomething isn't working
Description
For example this CLI command will throw an exception is rich isn't installed, although it works fine otherwise:
kasa --host 192.168.1.168 --username xxx --password xxx feature check_latest_firmware
Discovering device 192.168.1.168 for 10 seconds
Executing action check_latest_firmware
Raised error: expected string or bytes-like object, got 'UpdateInfo'
Run with --debug enabled to see stacktrace
the reason for this error reported by --debug:
[...]
Raised error: expected string or bytes-like object, got 'UpdateInfo'
Traceback (most recent call last):
[...]
File "/home/mash/.local/share/uv/tools/python-kasa/lib/python3.13/site-packages/kasa/cli/feature.py", line 125, in feature
echo(response)
~~~~^^^^^^^^^^
File "/home/mash/.local/share/uv/tools/python-kasa/lib/python3.13/site-packages/kasa/cli/common.py", line 57, in echo
_echo(*args, **kwargs)
~~~~~^^^^^^^^^^^^^^^^^
File "/home/mash/.local/share/uv/tools/python-kasa/lib/python3.13/site-packages/kasa/cli/common.py", line 45, in wrapper
message = rich_formatting.sub("", message)
TypeError: expected string or bytes-like object, got 'UpdateInfo'
The regex substitution used in this replacement for richs print() function only works for strings.
More complex objects need to be preprocessed by repr() in advance.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working