Open
Description
Python 3.9 on Windows 10 system.
Traceback (most recent call last):
File "C:\proj\grandstream-spectralink\src\__main__.py", line 17, in <module>
asyncio.run(run())
File "C:\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\proj\grandstream-spectralink\src\__main__.py", line 10, in run
await container.init_resources()
TypeError: object NoneType can't be used in 'await' expression
Process finished with exit code 1
async def run():
container = Container()
await container.init_resources()
try:
await container.service()
finally:
await container.shutdown_resources()
asyncio.run(run())
class Container(containers.DeclarativeContainer):
msg_queue = providers.Singleton(
asyncio.Queue,
maxsize=10,
)
also tried this variation thinking it may not recognize the async Queue as needing an event loop:
async def async_create_queue(*args, **kwargs):
return asyncio.Queue(*args, **kwargs)
class Container(containers.DeclarativeContainer):
msg_queue = providers.Singleton(
async_create_queue,
maxsize=10,
)
What's the trick to get container.init_resources()
to not return None
?