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

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

Open
didierga opened this issue Nov 25, 2021 · 14 comments
Open

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

didierga opened this issue Nov 25, 2021 · 14 comments

Comments

@didierga
Copy link

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'
$

@Bradara
Copy link

Bradara commented Nov 28, 2021

Ubuntu 21.10
The same error
after

pip install PyChromecast==1.0.3 zeroconf==0.19.1

restart and the problem resolved for me.

@beregon87
Copy link

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.

@didierga
Copy link
Author

didierga commented Dec 6, 2021

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.

@interfect
Copy link

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.

@michaldrabik
Copy link

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.

@didierga
Copy link
Author

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 ?

@vanadinit
Copy link

vanadinit commented Jan 29, 2022

This should fix it: vanadinit@151b53b

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 vanadinit@a1de1ae

@stele95
Copy link

stele95 commented Jan 29, 2022

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

@didierga
Copy link
Author

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 ?

@Senacharim
Copy link

Senacharim commented Nov 19, 2022

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

@stele95
Copy link

stele95 commented Nov 27, 2022

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

@Senacharim
Copy link

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)

@legz
Copy link

legz commented Jan 2, 2023

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 !

MaeIsBad pushed a commit to MaeIsBad/nixpkgs that referenced this issue Apr 11, 2023
The gnomecast pypi package is
outdated(see: keredson/gnomecast#178)
and doesn't work with the PyChromecast version in
nixpkgs(keredson/gnomecast#171).
@JorgeAT227
Copy link

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'

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

10 participants