Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catt errors on python 3.9 #349

Closed
scooper1 opened this issue Jul 6, 2021 · 27 comments
Closed

catt errors on python 3.9 #349

scooper1 opened this issue Jul 6, 2021 · 27 comments

Comments

@scooper1
Copy link

scooper1 commented Jul 6, 2021

under the lastest web terminal add-on in home assistant which has just been updated to python 3.9. it crashes at runtime with a library error

@skorokithakis
Copy link
Owner

What's the error?

@michael677r
Copy link

I’m pretty sure I have same issue - Output from the log - hope this is useful, and thanks for your help

Traceback (most recent call last):
File "/usr/bin/catt", line 8, in
sys.exit(main())
File "/usr/lib/python3.9/site-packages/catt/cli.py", line 644, in main
return cli(obj=get_config_as_dict())
File "/usr/lib/python3.9/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/catt/cli.py", line 307, in cast_site
cst = setup_cast(
File "/usr/lib/python3.9/site-packages/catt/controllers.py", line 78, in setup_cast
cast_device = get_cast_device(device_desc)
File "/usr/lib/python3.9/site-packages/catt/discovery.py", line 135, in get_cast_device
cast_device = get_cast_device_with_name(device_desc)
File "/usr/lib/python3.9/site-packages/catt/discovery.py", line 80, in get_cast_device_with_name
devices = get_cast_devices([device_name]) if device_name else get_cast_devices()
File "/usr/lib/python3.9/site-packages/catt/discovery.py", line 50, in get_cast_devices
devices = [
File "/usr/lib/python3.9/site-packages/catt/discovery.py", line 51, in
CastDevice(pychromecast.get_chromecast_from_cast_info(c, browser.zc), c.host, c.port) for c in cast_infos
File "/usr/lib/python3.9/site-packages/pychromecast/init.py", line 86, in get_chromecast_from_cast_info
return Chromecast(
File "/usr/lib/python3.9/site-packages/pychromecast/init.py", line 311, in init
dev_status = get_device_status(host, services, zconf)
File "/usr/lib/python3.9/site-packages/pychromecast/dial.py", line 109, in get_device_status
status = _get_status(
File "/usr/lib/python3.9/site-packages/pychromecast/dial.py", line 71, in _get_status
host, _, _ = get_host_from_service(service, zconf)
File "/usr/lib/python3.9/site-packages/pychromecast/dial.py", line 32, in get_host_from_service
service_info = zconf.get_service_info("_googlecast._tcp.local.", service.data)
File "/usr/lib/python3.9/site-packages/zeroconf/_core.py", line 452, in get_service_info
if info.request(self, timeout, question_type):
File "/usr/lib/python3.9/site-packages/zeroconf/_services/info.py", line 426, in request
assert zc.loop is not None and zc.loop.is_running()
AssertionError
[22:09:07] ERROR: Command exited with a failure status.

@scooper1
Copy link
Author

scooper1 commented Jul 6, 2021

I think the error was same as above but I rolled back Hassio add-on to previous version so do not have the error log. I will roll forward again to test or if more info. Required

@skorokithakis
Copy link
Owner

I can't reproduce this right now, can someone post the versions of catt, PyChromecast and zeroconf that produce the above traceback? Looks to me like an upgrade broke things again.

@theychx
Copy link
Collaborator

theychx commented Jul 6, 2021

The newest zeroconf release has a ton of changes, some of them apparently breaking pychromecast.

@scooper1
Copy link
Author

scooper1 commented Jul 6, 2021

Yes it's a upgrade of Hassio web terminal which has just been bumped to latest version
I am using latest version of Catt as this is installed automatically every time that add-on starts

@skorokithakis
Copy link
Owner

@theychx that makes sense. Can we pin to PyChromecast/zeroconf, since we recommend installing with pipx?

@scooper1
Copy link
Author

scooper1 commented Jul 6, 2021

Successfully installed PyChromecast-9.2.0 casttube-0.2.1 catt-0.12.1 protobuf-3.17.3 youtube-dl-2021.6.6

@theychx
Copy link
Collaborator

theychx commented Jul 6, 2021

Yep, 9.2.0 & 0.31.0

@skorokithakis
Copy link
Owner

I see that PyChromecast doesn't pin either, so we'd have to list zeroconf as a dependency... Not a great solution, and pinning PyChromecast itself wouldn't help with this. Maybe we can start pinning PyChromecast and urge them to pin zeroconf on their end?

Either way, I will close this ticket because it's an upstream issue. Thanks to everyone for their help!

@scooper1
Copy link
Author

scooper1 commented Jul 6, 2021

installing with startup option "python3 -m pip install catt" pipx is not available in this docker image

@skorokithakis
Copy link
Owner

pipx isn't needed for Docker, since it's already self-contained.

@theychx
Copy link
Collaborator

theychx commented Jul 6, 2021

@skorokithakis

so we'd have to list zeroconf as a dependency

At the moment, there is no way around that, if we want to make a working release.

@skorokithakis
Copy link
Owner

Yeah, I'm afraid you're right... I have left a comment on the PyChromecast issue, but I guess we should pin now and worry later.

@lolouk44
Copy link

lolouk44 commented Jul 9, 2021

I have the same issue but can't see above how to resolve this on my HA docker container installation?
Can anyone recommend a workaround? I tried to reinstall catt but still get the issue...

@scooper1
Copy link
Author

scooper1 commented Jul 9, 2021

you have to do a partial restore just doing that docker container
hope you got backups ....

@lolouk44
Copy link

lolouk44 commented Jul 9, 2021

you have to do a partial restore just doing that docker container
hope you got backups ....

Thanks. Can you elaborate?
I run ha in a container so I guess I could always restore the previous version. What do I need to recover / bring over to the new container please?

@scooper1
Copy link
Author

scooper1 commented Jul 9, 2021

thinking a bit more - if you are using web and terminal then role back to 8.24 by just restoring that addon
if you are installing in the hassio runtime system then you will have to go back to 2021.6

@J-o-h-n-M
Copy link

J-o-h-n-M commented Jul 10, 2021

My solution, for now, is that I reverted back to this docker 2021.6.6 . I just used Portainer to get this version and I did not need to restore anything. Afaik nothing broke with the downgrade.

@lolouk44
Copy link

thinking a bit more - if you are using web and terminal then role back to 8.24 by just restoring that addon
if you are installing in the hassio runtime system then you will have to go back to 2021.6

Thanks. I'll temporarily go back to 2021.6
Now since this really is a bug, should this issue be reopened? And is it going to be fixed so it can work on 2021.7 and up? Or is this a home assistant issue and if so is it tracked somewhere?

@skorokithakis
Copy link
Owner

This is a zeroconf/pychromecast issue but I will publish a workaround.

@skorokithakis
Copy link
Owner

I have published v0.12.2 which should fix this, please test and report back.

@J-o-h-n-M
Copy link

I have published v0.12.2 which should fix this, please test and report back.

Just updated to "homeassistant/home-assistant:latest" docker and then updated Catt to v0.12.2. Works like a charm!. Thanks for the quick update.

@scooper1
Copy link
Author

Working
Thank you for updating

@lolouk44
Copy link

Thanks I can also confirm that catt 0.12.2 fixes
(though I had to manually set the version to 0.12.2 with python3 -m pip install catt==0.12.2 for some reason )

@tobip
Copy link

tobip commented Oct 24, 2021

Since the last update on my system I also get this error.

catt version v0.12.1-2
python-pychromecast 9.2.1-1
python-zeroconf 0.36.4-1

All of them installed through AUR.

@MarcelRobitaille
Copy link

I am still getting this error in 0.12.2.

I get this error when doing catt scan. Strangely, I called that once with no chromecasts on my network and it printed Error: No devices found. I connected the chromecast to the network and ran it again and it listed my chromecast successfully, but the third time I tried to run it (after renaming the chromecast in the google home app, if that changes anything) I get this error.

Here's the error in a code block so it's a bit easier to read.

Scanning Chromecasts...
Traceback (most recent call last):
  File "/usr/bin/catt", line 33, in <module>
    sys.exit(load_entry_point('catt==0.12.1', 'console_scripts', 'catt')())
  File "/usr/lib/python3.9/site-packages/catt/cli.py", line 644, in main
    return cli(obj=get_config_as_dict())
  File "/home/marcel/.local/lib/python3.9/site-packages/click/core.py", line 1041, in __call__
    return self.main(*args, **kwargs)
  File "/home/marcel/.local/lib/python3.9/site-packages/click/core.py", line 971, in main
    rv = self.invoke(ctx)
  File "/home/marcel/.local/lib/python3.9/site-packages/click/core.py", line 1553, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/marcel/.local/lib/python3.9/site-packages/click/core.py", line 1309, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/marcel/.local/lib/python3.9/site-packages/click/core.py", line 719, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/catt/cli.py", line 483, in scan
    devices = get_cast_devices_info()
  File "/usr/lib/python3.9/site-packages/catt/discovery.py", line 65, in get_cast_devices_info
    devices = get_cast_devices()
  File "/usr/lib/python3.9/site-packages/catt/discovery.py", line 50, in get_cast_devices
    devices = [
  File "/usr/lib/python3.9/site-packages/catt/discovery.py", line 51, in <listcomp>
    CastDevice(pychromecast.get_chromecast_from_cast_info(c, browser.zc), c.host, c.port) for c in cast_infos
  File "/usr/lib/python3.9/site-packages/pychromecast/__init__.py", line 86, in get_chromecast_from_cast_info
    return Chromecast(
  File "/usr/lib/python3.9/site-packages/pychromecast/__init__.py", line 311, in __init__
    dev_status = get_device_status(host, services, zconf)
  File "/usr/lib/python3.9/site-packages/pychromecast/dial.py", line 109, in get_device_status
    status = _get_status(
  File "/usr/lib/python3.9/site-packages/pychromecast/dial.py", line 71, in _get_status
    host, _, _ = get_host_from_service(service, zconf)
  File "/usr/lib/python3.9/site-packages/pychromecast/dial.py", line 32, in get_host_from_service
    service_info = zconf.get_service_info("_googlecast._tcp.local.", service.data)
  File "/usr/lib/python3.9/site-packages/zeroconf/_core.py", line 523, in get_service_info
    if info.request(self, timeout, question_type):
  File "/usr/lib/python3.9/site-packages/zeroconf/_services/info.py", line 455, in request
    assert zc.loop is not None and zc.loop.is_running()
AssertionError

catt --version reports catt v0.12.2, Zaniest Zapper. although the AUR package version still says 0.12.1.r7.g0519e00-1 for some reason. System Python version is 3.9.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants