NotImplementedError raised inside asyncio/uvloop/fastapi
See original GitHub issue🪲 Describe the bug when using apprise with asyncio/uvloop (FastAPI) notify raises NotImplementedError
💡 Screenshots and Logs
Traceback (most recent call last):
File "/.venv/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 396, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/.venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/.venv/lib/python3.9/site-packages/fastapi/applications.py", line 199, in __call__
await super().__call__(scope, receive, send)
File "/.venv/lib/python3.9/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/.venv/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/.venv/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/.venv/lib/python3.9/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/.venv/lib/python3.9/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/.venv/lib/python3.9/site-packages/starlette/routing.py", line 41, in app
response = await func(request)
File "/.venv/lib/python3.9/site-packages/fastapi/routing.py", line 201, in app
raw_response = await run_endpoint_function(
File "/.venv/lib/python3.9/site-packages/fastapi/routing.py", line 150, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/.venv/lib/python3.9/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool
return await loop.run_in_executor(None, func, *args)
File "/usr/local/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "./app/main.py", line 86, in test
apprise.notify('test')
File "/.venv/lib/python3.9/site-packages/apprise/Apprise.py", line 441, in notify
if not py3compat.asyncio.notify(coroutines, debug=self.debug):
File "/.venv/lib/python3.9/site-packages/apprise/py3compat/asyncio.py", line 68, in notify
asyncio.run(main(results, coroutines), debug=debug)
File "/usr/local/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 49, in run
loop.run_until_complete(loop.shutdown_default_executor())
File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
File "/usr/local/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py", line 253, in shutdown_default_executor
raise NotImplementedError
NotImplementedError
💻 Your System Details:
- OS: MacOS and Docker (python:3)
- Python Version: 3.9
🔮 Additional context
from fastapi import FastAPI
app = FastAPI()
@app.get('/test')
def test():
apprise.notify('test')
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Asyncio.create_subprocess_exec NotImplementedError
I am running this in windows using an asyncio loop, not uvloop. import asyncio from fastapi import FastAPI, BackgroundTasks DHCP_SERVER = "1.1.
Read more >Running an Asyncio Subprocess in FastApi results in ... - GitHub
Running an Asyncio Subprocess in FastApi results in NotImplementedError (On Windows) #4361. Open. 9 tasks done. curtwagner1984 opened this issue on Jan 3 ......
Read more >encode/community - Gitter
I was going to file a feature request ticket but the checklist said to raise it in here first :) cdeler.
Read more >fastapi asyncio.run() cannot be called from a running event loop
While trying to develop a FastAPI client in Spyder environment, one cannot start the execution. The code fails and raises: RuntimeError: asyncio.run() ...
Read more >theHarvester - Bountysource
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "uvloop/loop.pyx", line 1450, in uvloop.loop.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ah you’re right. thanks for looking into this and the reply. I’ll follow the ticket you mentioned
@derekn
IDK why, but this works with FastAPI