-
Notifications
You must be signed in to change notification settings - Fork 339
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
async @after()
handler crashes with TypeError
#117
Comments
OrangeTux
referenced
this issue
Sep 18, 2020
In order to avoid the following warning: ``` /.../lib/python3.8/site-packages/ocpp/charge_point.py:184: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead response = await asyncio.coroutine(handler)(**snake_case_payload) ```
This was referenced Sep 18, 2020
OrangeTux
added a commit
that referenced
this issue
Sep 18, 2020
The response of the handler was passed to `asyncio.ensure_future()` and that resulted in a `TypeError`. ``` Traceback (most recent call last): File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/websockets/server.py", line 191, in handler await self.ws_handler(self, path) File "examples/v16/central_system.py", line 44, in on_connect await cp.start() File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/ocpp/charge_point.py", line 126, in start await self.route_message(message) File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/ocpp/charge_point.py", line 144, in route_message await self._handle_call(msg) File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/ocpp/charge_point.py", line 222, in _handle_call asyncio.ensure_future(response) File "/home/developer/.pyenv/versions/3.8.0/lib/python3.8/asyncio/tasks.py", line 673, in ensure_future raise TypeError('An asyncio.Future, a coroutine or an awaitable is ' TypeError: An asyncio.Future, a coroutine or an awaitable is required ``` Fixes: #117
ajmirsky
pushed a commit
to ajmirsky/ocpp
that referenced
this issue
Nov 26, 2024
The response of the handler was passed to `asyncio.ensure_future()` and that resulted in a `TypeError`. ``` Traceback (most recent call last): File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/websockets/server.py", line 191, in handler await self.ws_handler(self, path) File "examples/v16/central_system.py", line 44, in on_connect await cp.start() File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/ocpp/charge_point.py", line 126, in start await self.route_message(message) File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/ocpp/charge_point.py", line 144, in route_message await self._handle_call(msg) File "/home/developer/projects/tmh-ocpp/.env/lib/python3.8/site-packages/ocpp/charge_point.py", line 222, in _handle_call asyncio.ensure_future(response) File "/home/developer/.pyenv/versions/3.8.0/lib/python3.8/asyncio/tasks.py", line 673, in ensure_future raise TypeError('An asyncio.Future, a coroutine or an awaitable is ' TypeError: An asyncio.Future, a coroutine or an awaitable is required ``` Fixes: mobilityhouse#117
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Release v0.7.0 introduces a bug when executing
@after()
handler that are marked with theasync
keyword. Thanks @shirley-li-powerflex for reporting it.Here a code sample demonstrating the problem:
When ran using v0.7.0 the following stracktrace is generated:
Non-async
@after()
handlers are not affected.The text was updated successfully, but these errors were encountered: