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

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

Closed
roumano opened this issue Nov 25, 2021 · 7 comments · Fixed by #69841
Closed

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

roumano opened this issue Nov 25, 2021 · 7 comments · Fixed by #69841
Assignees

Comments

@roumano
Copy link

roumano commented Nov 25, 2021

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
@probot-home-assistant
Copy link

brother documentation
brother source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @bieniu, mind taking a look at this issue as it has been labeled with an integration (brother) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@bieniu
Copy link
Member

bieniu commented Nov 25, 2021

This problem is related to pysnmp package, not to the Brother integration etingof/pysnmp#413

@github-actions github-actions bot added the stale label Dec 25, 2021
@flaviut
Copy link

flaviut commented Dec 26, 2021

hi mr stale bot, this is still an issue.

@flaviut
Copy link

flaviut commented Dec 26, 2021

Looks like the pysnmp package is completely unmaintained since the start of 2020, as it only has one contributor who is no longer working on it.

I've submitted a PR at etingof/pysnmp#415

I'll try to reach out the the maintainer directly in a month if I don't hear back by then.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 27, 2022
@flaviut
Copy link

flaviut commented Mar 27, 2022

Looks like a few folks (who seem reliable to me) have forked this into https://github.com/pysnmp/pysnmp/. The new library is https://pypi.org/project/pysnmplib/ on pypi. (still an issue though, until

pysnmp==4.4.12
changes)

@github-actions github-actions bot removed the stale label Mar 27, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants