Is asyncio supported?
Hi, I am trying to use shiv to deploy an executable for an asyncio based app using poetry as the build tool and I am running into a coroutine not awaited error that I can't see where it stems from; can you point me in the right direction? is this something you have seen before?. I have the following project tree:
Project-name
src
build.sh
project_name
__init__.py
__main__.py
app.py
**.py
build.sh
shiv -p "$interpreter" -e bacnet_client.app:main --site-packages "$site_path" -o dist/project_name.pyz
python3.10 dist/project_name.pyz
main.py
import asyncio
import bacnet_client as app
async def main():
await app.main()
if __name__ == "__main__":
asyncio.run(main())
app.py
import asyncio
import logging
import queue
import json
import re
from logging.handlers import QueueHandler
async def main():
"""
Run or schedule all your services from this entry-point script.
"""
try:
loop = asyncio.get_running_loop()
logQ = queue.Queue()
logProducer = QueueHandler(logQ)
logProducer.setFormatter(JsonFormatter(datefmt=ISO8601))
logger = logging.getLogger('ClientLog')
logger.addHandler(logProducer)
logger.setLevel(logging.DEBUG)
logger_task = loop.create_task(log(logQ))
await logger_task
finally:
logger.info("Client application stopping:")
logger.info(None)
logger_task.cancel()
if __name__ == "__main__":
asyncio.run(main())
Ultimately the error output after running build.sh is as follows: <coroutine object main at 0x7f62e17037d0> sys:1: RuntimeWarning: coroutine 'main' was never awaited RuntimeWarning: Enable tracemalloc to get the object allocation traceback
PS.
I did import the tracemalloc and wired some functions into the app.py's main function and __main__.py but it failed with the same error and tracemalloc did not provide any output.
Thank you so much.
I'm facing similar issue when I'm trying to use this with a tornado application. Getting below error.
<coroutine object main at 0x7fc2538df790>
sys:1: RuntimeWarning: coroutine 'main' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback