Skip to content

HA 2021.11.05 python 3.10 brother.utils module 'asyncio' has no attribute 'async' #60350

@roumano

Description

@roumano

The problem

I'm try to adding a brother network printer via the Brother Printer integration

I got a error "Unknown error occurred" when set the host

What version of Home Assistant Core has the issue?

core-2021.11.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Brother Printer

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

After putting HA in debug mode i'm get this stack traces : 


nov. 25 17:49:48 rasp hass[24869]: 2021-11-25 17:49:48 DEBUG (MainThread) [homeassistant.components.brother.utils] Creating SNMP engine
nov. 25 17:49:49 rasp hass[24869]: 2021-11-25 17:49:49 DEBUG (MainThread) [brother] Using host: 192.168.1.21
nov. 25 17:49:49 rasp hass[24869]: 2021-11-25 17:49:49 ERROR (MainThread) [aiohttp.server] Error handling request
nov. 25 17:49:49 rasp hass[24869]: Traceback (most recent call last):
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/pysnmp/carrier/asyncio/dgram/base.py", line 93, in openClientMode
nov. 25 17:49:49 rasp hass[24869]:     self._lport = getattr(asyncio, 'async')(c)
nov. 25 17:49:49 rasp hass[24869]: AttributeError: module 'asyncio' has no attribute 'async'
nov. 25 17:49:49 rasp hass[24869]: During handling of the above exception, another exception occurred:
nov. 25 17:49:49 rasp hass[24869]: Traceback (most recent call last):
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
nov. 25 17:49:49 rasp hass[24869]:     resp = await self._request_handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/aiohttp/web_app.py", line 499, in _handle
nov. 25 17:49:49 rasp hass[24869]:     resp = await handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 119, in impl
nov. 25 17:49:49 rasp hass[24869]:     return await handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
nov. 25 17:49:49 rasp hass[24869]:     return await handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
nov. 25 17:49:49 rasp hass[24869]:     return await handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
nov. 25 17:49:49 rasp hass[24869]:     return await handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware
nov. 25 17:49:49 rasp hass[24869]:     return await handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/auth.py", line 138, in auth_middleware
nov. 25 17:49:49 rasp hass[24869]:     return await handler(request)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/view.py", line 135, in handle
nov. 25 17:49:49 rasp hass[24869]:     result = await result
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/config/config_entries.py", line 157, in post
nov. 25 17:49:49 rasp hass[24869]:     return await super().post(request, flow_id)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/http/data_validator.py", line 62, in wrapper
nov. 25 17:49:49 rasp hass[24869]:     result = await method(view, request, *args, **kwargs)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/helpers/data_entry_flow.py", line 110, in post
nov. 25 17:49:49 rasp hass[24869]:     result = await self._flow_mgr.async_configure(flow_id, data)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/data_entry_flow.py", line 246, in async_configure
nov. 25 17:49:49 rasp hass[24869]:     result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/data_entry_flow.py", line 320, in _async_handle_step
nov. 25 17:49:49 rasp hass[24869]:     result: FlowResult = await getattr(flow, method)(user_input)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/homeassistant/components/brother/config_flow.py", line 62, in async_step_user
nov. 25 17:49:49 rasp hass[24869]:     await brother.async_update()
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/brother/__init__.py", line 99, in async_update
nov. 25 17:49:49 rasp hass[24869]:     if not (raw_data := await self._get_data()):
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/brother/__init__.py", line 233, in _get_data
nov. 25 17:49:49 rasp hass[24869]:     await self._init_device()
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/brother/__init__.py", line 303, in _init_device
nov. 25 17:49:49 rasp hass[24869]:     errindication, errstatus, errindex, _ = await hlapi.getCmd(*request_args, *oids)
nov. 25 17:49:49 rasp hass[24869]:   File "/usr/local/lib/python3.10/asyncio/coroutines.py", line 124, in coro
nov. 25 17:49:49 rasp hass[24869]:     res = func(*args, **kw)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/pysnmp/hlapi/asyncio/cmdgen.py", line 151, in getCmd
nov. 25 17:49:49 rasp hass[24869]:     addrName, paramsName = lcd.configure(
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/pysnmp/hlapi/lcd.py", line 91, in configure
nov. 25 17:49:49 rasp hass[24869]:     transport = transportTarget.openClientMode()
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/pysnmp/hlapi/transport.py", line 53, in openClientMode
nov. 25 17:49:49 rasp hass[24869]:     self.transport = self.protoTransport().openClientMode(self.iface)
nov. 25 17:49:49 rasp hass[24869]:   File "/data/homeassistant/lib/python3.10/site-packages/pysnmp/carrier/asyncio/dgram/base.py", line 96, in openClientMode
nov. 25 17:49:49 rasp hass[24869]:     raise error.CarrierError(';'.join(traceback.format_exception(*sys.exc_info())))
nov. 25 17:49:49 rasp hass[24869]: pysnmp.carrier.error.CarrierError: Traceback (most recent call last):
nov. 25 17:49:49 rasp hass[24869]: ;  File "/data/homeassistant/lib/python3.10/site-packages/pysnmp/carrier/asyncio/dgram/base.py", line 93, in openClientMode
nov. 25 17:49:49 rasp hass[24869]:     self._lport = getattr(asyncio, 'async')(c)
nov. 25 17:49:49 rasp hass[24869]: ;AttributeError: module 'asyncio' has no attribute 'async'
nov. 25 17:49:49 rasp hass[24869]: caused by <class 'AttributeError'>: module 'asyncio' has no attribute 'async'


### Additional information

Python version : 3.10.0

Metadata

Metadata

Assignees

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions