gnomecast icon indicating copy to clipboard operation
gnomecast copied to clipboard

AttributeError: 'Chromecast' object has no attribute 'device'

Open didierga opened this issue 3 years ago • 14 comments

Hi,

Using Fedora 35, I get following messages when gnomecast try to find chromecast.

chromium-freeworld-96.0.4664.45-1.fc35.x86_64 find the chromecast and casts on it with no problem.

Environment:

Fedora 35 gnomecast 1.9.11 python3-chromecast-9.3.1-1.fc35.noarch

Messages:

$ gnomecast update_button_visible None update_button_visible update_button_visible serving on http://192.168.1.11:55281 check_ffmpeg b'/usr/bin/ffmpeg\n' Traceback (most recent call last): File "/home/didier/.local/lib/python3.10/site-packages/gnomecast.py", line 566, in f friendly_name = cc.device.friendly_name AttributeError: 'Chromecast' object has no attribute 'device' $

didierga avatar Nov 25 '21 12:11 didierga

Ubuntu 21.10 The same error after

pip install PyChromecast==1.0.3 zeroconf==0.19.1

restart and the problem resolved for me.

Bradara avatar Nov 28 '21 18:11 Bradara

Ubuntu 21.10 The same error after

pip install PyChromecast==1.0.3 zeroconf==0.19.1

restart and the problem resolved for me.

This worked for me as well on Xubuntu 20.04 and Python 3.8.10.

beregon87 avatar Dec 05 '21 21:12 beregon87

In Fedora 35, I installed python3-chromecast and its pre and co-requisites:

python3-protobuf-3.14.0-6.fc35.noarch python3-ifaddr-0.1.7-5.fc35.noarch python3-zeroconf-0.36.9-1.fc35.noarch python3-casttube-0.2.1-4.fc35.noarch python3-chromecast-9.3.1-1.fc35.noarch

After installation I have installed:

$ pip3 list
Package              Version
-------------------- ------------
---/---
PyChromecast         10.1.1
---/---
zeroconf             0.37.0

and I get error above.

didierga avatar Dec 06 '21 20:12 didierga

The issue is that PyChromecast dropped the device property in release 10.0, 25 days ago. See https://github.com/home-assistant-libs/pychromecast/releases/tag/10.0.0 and https://github.com/home-assistant-libs/pychromecast/pull/556. All that stuff is now in cast_info instead.

So the easy fix is to set pychromecast<10 in requirements.txt and cut a release, then actually fix it and start depending on pychromecast>10,<11.

interfect avatar Dec 10 '21 02:12 interfect

Ubuntu 21.10 The same error after

pip install PyChromecast==1.0.3 zeroconf==0.19.1

restart and the problem resolved for me.

Helped me too. Thanks.

michaldrabik avatar Jan 03 '22 21:01 michaldrabik

The issue is that PyChromecast dropped the device property in release 10.0, 25 days ago. See https://github.com/home-assistant-libs/pychromecast/releases/tag/10.0.0 and home-assistant-libs/pychromecast#556. All that stuff is now in cast_info instead.

So the easy fix is to set pychromecast<10 in requirements.txt and cut a release, then actually fix it and start depending on pychromecast>10,<11.

Now the problem is identified can we hope to have a new version of gnomecast who fix it ?

didierga avatar Jan 11 '22 07:01 didierga

This should fix it: https://github.com/vanadinit/gnomecast/commit/151b53bd4ca183c291b5b8f98ae83cb38745081a

Feel free to cherry-pick or copy the changes.

I am going to fix various things in my fork to get this going for my own setup. Maybe I make a pull-request back to this, but I am not sure how to handle invasive changes, it will be more a rewrite than little adjustments.

Edit: Just discovered that you need also the two cc.name lines from https://github.com/vanadinit/gnomecast/commit/a1de1aea952422b7edb03884d5bf4746c23b658a

vanadinit avatar Jan 29 '22 15:01 vanadinit

I created a PR with the changes that are the same as the two commits @vanadinit mentioned, hopefully they will merge it.

stele95 avatar Jan 29 '22 22:01 stele95

I created a PR with the changes that are the same as the two commits @vanadinit mentioned, hopefully they will merge it.

Do you plan to merge this PR ?

didierga avatar Mar 11 '22 21:03 didierga

Used:

pip install PyChromecast==1.0.3 zeroconf==0.19.1

no restart and the problem resolved for me.

This worked. Ubuntu 22.04 and Python 3.10

Senacharim avatar Nov 19 '22 20:11 Senacharim

I created a PR with the changes that are the same as the two commits @vanadinit mentioned, hopefully they will merge it.

Do you plan to merge this PR ?

The problem was fixed, the current master branch detects the device successfully

stele95 avatar Nov 27 '22 19:11 stele95

I created a PR with the changes that are the same as the two commits @vanadinit mentioned, hopefully they will merge it.

Do you plan to merge this PR ?

The problem was fixed, the current master branch detects the device successfully

Had problem indicated in this thread (in Nov, 2022) and used the indicated fix to resolve it.

Perhaps the fix wasn't tested with the original Nvidia Shield and has some edge cases, I don't know.

Got error, found fix, fix worked.

Error exists in software. (sorry)

Senacharim avatar Nov 27 '22 23:11 Senacharim

I just tried the workaround (PyChromecast==1.0.3 zeroconf==0.19.1) and Gnomecast does not launch anymore:

Traceback (most recent call last):
  File "/home/legz/.local/bin/gnomecast", line 8, in <module>
    sys.exit(main())
  File "/home/legz/.local/lib/python3.8/site-packages/gnomecast.py", line 1570, in main
    caster = Gnomecast()
  File "/home/legz/.local/lib/python3.8/site-packages/gnomecast.py", line 400, in __init__
    self.app = bottle.Bottle()
NameError: name 'bottle' is not defined

I applied the fix suggested in the PR, and everything works fine. Thanks @stele95 !

legz avatar Jan 02 '23 00:01 legz

Same problem here 22.04.03 Mate 1.26.0 Gnomecast 1.9.11

Traceback (most recent call last): File "/home/jorgeat/.local/lib/python3.10/site-packages/gnomecast.py", line 1365, in on_cast_combo_changed self.get_nonlocal_cast() File "/home/jorgeat/.local/lib/python3.10/site-packages/gnomecast.py", line 1350, in get_nonlocal_cast cast = pychromecast.Chromecast(text) File "/home/jorgeat/.local/lib/python3.10/site-packages/pychromecast/init.py", line 269, in init if not cast_info.cast_type: AttributeError: 'str' object has no attribute 'cast_type'

JorgeAT227 avatar Sep 13 '23 02:09 JorgeAT227