Title: CLI `_echo` doesn't work without `import rich` for non-String reports · Issue #1618 · python-kasa/python-kasa · GitHub
Open Graph Title: CLI `_echo` doesn't work without `import rich` for non-String reports · Issue #1618 · python-kasa/python-kasa
X Title: CLI `_echo` doesn't work without `import rich` for non-String reports · Issue #1618 · python-kasa/python-kasa
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...
Open Graph 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...
X 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_firm...
Opengraph URL: https://github.com/python-kasa/python-kasa/issues/1618
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CLI `_echo` doesn't work without `import rich` for non-String reports","articleBody":"For example this CLI command will throw an exception is `rich` isn't installed, although it works fine otherwise:\n```\nkasa --host 192.168.1.168 --username xxx --password xxx feature check_latest_firmware\nDiscovering device 192.168.1.168 for 10 seconds\nExecuting action check_latest_firmware\nRaised error: expected string or bytes-like object, got 'UpdateInfo'\nRun with --debug enabled to see stacktrace\n```\n\nthe reason for this error reported by `--debug`:\n```\n[...]\nRaised error: expected string or bytes-like object, got 'UpdateInfo'\nTraceback (most recent call last):\n[...]\nFile \"/home/mash/.local/share/uv/tools/python-kasa/lib/python3.13/site-packages/kasa/cli/feature.py\", line 125, in feature\n echo(response)\n ~~~~^^^^^^^^^^\n File \"/home/mash/.local/share/uv/tools/python-kasa/lib/python3.13/site-packages/kasa/cli/common.py\", line 57, in echo\n _echo(*args, **kwargs)\n ~~~~~^^^^^^^^^^^^^^^^^\n File \"/home/mash/.local/share/uv/tools/python-kasa/lib/python3.13/site-packages/kasa/cli/common.py\", line 45, in wrapper\n message = rich_formatting.sub(\"\", message)\nTypeError: expected string or bytes-like object, got 'UpdateInfo'\n```\n\nThe regex substitution used in this replacement for `rich`s `print()` function only works for strings.\n\nMore complex objects need to be preprocessed by `repr()` in advance. ","author":{"url":"https://github.com/mash-graz","@type":"Person","name":"mash-graz"},"datePublished":"2025-11-29T05:37:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1618/python-kasa/issues/1618"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fe06cccd-42ef-0667-a0c6-2a812c513cd0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D9A0:1271F3:B7D367:F16471:69829775 |
| html-safe-nonce | cb8d26a6a1d9a1474343b5fdeb93d5a80cd06f13ecc38cba0e83a954cc347a20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUEwOjEyNzFGMzpCN0QzNjc6RjE2NDcxOjY5ODI5Nzc1IiwidmlzaXRvcl9pZCI6IjQzNjQ3NTkzNjk1NzM4OTgxMDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | eda35f4c1cde406a876c6ac48b56193a9a57b5234756c2636852aac85ca2e0e2 |
| hovercard-subject-tag | issue:3676379105 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-kasa/python-kasa/1618/issue_layout |
| twitter:image | https://opengraph.githubassets.com/902919eda4d6f6d98628e308e8bad9e0c7dc923a77dcec7ded02ea483d21c9a3/python-kasa/python-kasa/issues/1618 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/902919eda4d6f6d98628e308e8bad9e0c7dc923a77dcec7ded02ea483d21c9a3/python-kasa/python-kasa/issues/1618 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mash-graz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2ff31560a6c13935e1216cfe10e9bfb1563f27204463a78984663afdffa4cead |
| turbo-cache-control | no-preview |
| go-import | github.com/python-kasa/python-kasa git https://github.com/python-kasa/python-kasa.git |
| octolytics-dimension-user_id | 57733869 |
| octolytics-dimension-user_login | python-kasa |
| octolytics-dimension-repository_id | 221571611 |
| octolytics-dimension-repository_nwo | python-kasa/python-kasa |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 221571611 |
| octolytics-dimension-repository_network_root_nwo | python-kasa/python-kasa |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ceb8a7a2995efbfdc2e609df19dca8f6a7f02afd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width