core: Linkplay, cannot set up Wiim Pro Plus - `AttributeError: '_io.TextIOWrapper' object has no attribute 'delete'`

The problem

image Look at stack trace

What version of Home Assistant Core has the issue?

core-2024.9.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

linkplay

Link to integration documentation on our website

https://www.home-assistant.io/integrations/linkplay

Diagnostics information

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/discovery_flow.py", line 108, in _async_start
    await gather_with_limited_concurrency(FLOW_INIT_LIMIT, *init_coros)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 114, in gather_with_limited_concurrency
    return await gather(
           ^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 112, in sem_task
    return await task
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1296, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1331, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/linkplay/config_flow.py", line 34, in async_step_zeroconf
    session: ClientSession = await async_get_client_session(self.hass)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/linkplay/utils.py", line 61, in async_get_client_session
    clientsession: ClientSession = await async_create_unverified_client_session()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 200, in async_create_unverified_client_session
    context: ssl.SSLContext = await async_create_unverified_context()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 147, in async_create_unverified_context
    async with aiofiles.tempfile.NamedTemporaryFile(
  File "/usr/local/lib/python3.12/site-packages/aiofiles/base.py", line 78, in __aenter__
    self._obj = await self._coro
                ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiofiles/tempfile/__init__.py", line 177, in _temporary_file
    result.delete = f.delete
                    ^^^^^^^^
  File "/usr/local/lib/python3.12/tempfile.py", line 494, in __getattr__
    a = getattr(file, name)
        ^^^^^^^^^^^^^^^^^^^
AttributeError: '_io.TextIOWrapper' object has no attribute 'delete'

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

I’ve went through a lot of old issues and found one custom integration (https://github.com/UI-Lovelace-Minimalist/UI) forcing that dependency to exactly v0.8.0. You’ve already mentioned you don’t have any custom integrations installed, but I can suggest to double check just to be sure. If you run docker exec -it 3d37ca219864 /bin/bash again and then check folder contents of /config/custom_components, it should be empty. Honestly, I think you can do pip install aiofiles==24.1.0 and it may be solved as well in your installation, but I’m not sure about that.

I’m getting diagnostics added to the integration to help getting issues like this faster solved.

I’ve opened a PR to add it to the package constraints. Thank you both for digging into your installation to find the root cause.

I will close this issue now.

For future reference: The issue was that I had UI-Lovelace-Minimalist custom integration installed though HACS, try uninstalling it 😃