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

Crash on discover with API #405

Closed
soreau opened this issue Jun 28, 2022 · 8 comments
Closed

Crash on discover with API #405

soreau opened this issue Jun 28, 2022 · 8 comments

Comments

@soreau
Copy link
Contributor

soreau commented Jun 28, 2022

Traceback (most recent call last):
File "/home/scott/.local/lib/python3.8/site-packages/cattqt/cattqt.py", line 402, in run
self.s.devices = catt.api.discover()
File "/home/scott/.local/lib/python3.8/site-packages/catt/api.py", line 167, in discover
return [CattDevice(ip_addr=c.ip) for c in get_casts()]
File "/home/scott/.local/lib/python3.8/site-packages/catt/api.py", line 167, in
return [CattDevice(ip_addr=c.ip) for c in get_casts()]
AttributeError: 'Chromecast' object has no attribute 'ip'

I run catt.api.discover() but it gives this.

@skorokithakis
Copy link
Owner

Works for me with catt 0.12.9:

16:01:17 $ ipython
Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from catt.api import discover

In [2]: discover()
Out[2]: []

@soreau
Copy link
Contributor Author

soreau commented Jun 28, 2022

$ catt --version
catt v0.12.9, Zaniest Zapper.
$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from catt.api import discover
>>> discover()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/scott/.local/lib/python3.8/site-packages/catt/api.py", line 167, in discover
    return [CattDevice(ip_addr=c.ip) for c in get_casts()]
  File "/home/scott/.local/lib/python3.8/site-packages/catt/api.py", line 167, in <listcomp>
    return [CattDevice(ip_addr=c.ip) for c in get_casts()]
AttributeError: 'Chromecast' object has no attribute 'ip'
>>> 

@soreau
Copy link
Contributor Author

soreau commented Jun 28, 2022

Also there's at least one other person that is getting the same error here.

@soreau
Copy link
Contributor Author

soreau commented Jun 28, 2022

Maybe you need to run discover() with a chromecast device on the network? When I try without network connection, I get the same output as you (it does not crash).

@skorokithakis
Copy link
Owner

Ah hmm, maybe, I'll try that. Due to a peculiar network setup, discovery doesn't work for me, but I'll try to get a Chromecast soon.

@skorokithakis skorokithakis reopened this Jun 28, 2022
@soreau
Copy link
Contributor Author

soreau commented Jun 28, 2022

I found this makes discover work: return [CattDevice(ip_addr=c.socket_client.host) for c in get_casts()] found here.

@skorokithakis
Copy link
Owner

That's great, thank you! Would you mind submitting a PR?

@soreau
Copy link
Contributor Author

soreau commented Jun 28, 2022

I have made one here.

soreau added a commit to soreau/catt that referenced this issue Jun 28, 2022
The path to get the ip from pychromecast is now c.socket_client.host

Closes skorokithakis#405
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

2 participants