Crash on discover with API
Closed this issue · 8 comments
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.
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]: []
$ 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'
>>>
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).
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.
I found this makes discover work: return [CattDevice(ip_addr=c.socket_client.host) for c in get_casts()]
found here.
That's great, thank you! Would you mind submitting a PR?