pychromecast
pychromecast copied to clipboard
UnboundLocalError at first try
I cant figure out the error, but the test script throws this. fresh install
from __future__ import print_function
import time
import pychromecast
pychromecast.get_chromecasts_as_dict().keys()
i get
>>> from __future__ import print_function
>>> import time
>>> import pychromecast
>>> pychromecast.get_chromecasts_as_dict().keys()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pychromecast\__init__.py", line 131, in get_chromecasts_as_dict
**filters)}
File "C:\Python27\lib\site-packages\pychromecast\__init__.py", line 88, in get_chromecasts
cc_list = set(_get_all_chromecasts(tries, retry_wait, timeout))
File "C:\Python27\lib\site-packages\pychromecast\__init__.py", line 39, in _get_all_chromecasts
hosts = discover_chromecasts()
File "C:\Python27\lib\site-packages\pychromecast\discovery.py", line 89, in discover_chromecasts
browser.cancel()
UnboundLocalError: local variable 'browser' referenced before assignment
>>>
i first thought dongle could not be found but that aint the case with second test script.
from __future__ import print_function
import time
import pychromecast
from pychromecast import *
CHROMECAST_HOST = '10.0.0.187'
globals = [0]
bob = pychromecast.get_device_status('10.0.0.187')
print (bob)
cast = pychromecast.Chromecast(CHROMECAST_HOST)
it finds dongle but get second error here.
DeviceStatus(friendly_name=u'Pegasus-Cast', model_name=u'Eureka Dongle', manufacturer=u'Google Inc.', api_version=(1, 0), uuid=UUID('**********-18ab-1a1a-d241-ceceb703f7e0'), cast_type='cast')
No handlers could be found for logger "pychromecast.socket_client"
I am encountering the same issue with both Python 2 and 3 on Ubuntu.