Eerovil/castextensions

I get this error: 'NoneType' object has no attribute 'proxy'

Opened this issue · 2 comments

llego commented

Hi, I get the error below when launching a script. I'm on the latest version of Home Assistant. Do you know what's going on?

Here's the script I'm trying to run:

alias: Cast yleareena to My Chromecast
sequence:
  - data:
      entity_id: media_player.google_nest
      media_content_type: cast
      media_content_id: ' { "app_name": "yleareena", "media_id": "1-4521287" }'
    service: cast_extensions.play_media
mode: single

Here's my configuration.yml:

cast_extensions:
  areena_key: app_id=zzzzzzz&app_key=zzzzzzzzzzzzzzzzzzzzzzzzz
Logger: homeassistant.components.script.1641137450485
Source: custom_components/cast_extensions/app_yleareena.py:78
Integration: Scripts (documentation, issues)
First occurred: 19:20:08 (2 occurrences)
Last logged: 19:25:20

Cast yleareena to My Chromecast: Error executing script. Unexpected error for call_service at pos 1: 'NoneType' object has no attribute 'proxy'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 733, in admin_handler
    await result
  File "/config/custom_components/cast_extensions/__init__.py", line 43, in async_quick_play
    await hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/cast_extensions/__init__.py", line 78, in quick_play
    kaltura_id = YleAreena.get_kaltura_id(program_id)
  File "/config/custom_components/cast_extensions/app_yleareena.py", line 78, in get_kaltura_id
    httpclient = HttpClient(None)
  File "/usr/local/lib/python3.9/site-packages/yledl/http.py", line 17, in __init__
    self._session = self._create_session(io.proxy)
AttributeError: 'NoneType' object has no attribute 'proxy'

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/cast_extensions/app_yleareena.py:78
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 19:20:08 (3 occurrences)
Last logged: 19:39:25

[139854883003120] 'NoneType' object has no attribute 'proxy'
[139854880356720] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 273, in service_handler
    await script_entity.async_turn_on(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 377, in async_turn_on
    await coro
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 403, in _async_run
    return await self.script.async_run(script_vars, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1260, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 733, in admin_handler
    await result
  File "/config/custom_components/cast_extensions/__init__.py", line 43, in async_quick_play
    await hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/cast_extensions/__init__.py", line 78, in quick_play
    kaltura_id = YleAreena.get_kaltura_id(program_id)
  File "/config/custom_components/cast_extensions/app_yleareena.py", line 78, in get_kaltura_id
    httpclient = HttpClient(None)
  File "/usr/local/lib/python3.9/site-packages/yledl/http.py", line 17, in __init__
    self._session = self._create_session(io.proxy)
AttributeError: 'NoneType' object has no attribute 'proxy'

Yle areena support might be broken by updates (along with other things). I'll need to try it

llego commented

Thanks! Note that I haven't tried this script before. I just installed it. I'm trying to set up a button in Lovelace that plays the latest episode of DJ Lux from Yle Vega :)