1
0
mirror of https://github.com/ijaric/voice_assistant.git synced 2025-05-24 14:33:26 +00:00
voice_assistant/src/assistant/bin/__main__.py
2023-10-03 21:29:55 +01:00

38 lines
757 B
Python

import asyncio
import logging
import os
import lib.app as app
logger = logging.getLogger(__name__)
async def run() -> None:
settings = app.Settings()
application = app.Application.from_settings(settings)
try:
await application.start()
finally:
await application.dispose()
def main() -> None:
try:
asyncio.run(run())
exit(os.EX_OK)
except SystemExit:
exit(os.EX_OK)
except app.ApplicationError:
exit(os.EX_SOFTWARE)
except KeyboardInterrupt:
logger.info("Exited with keyboard interruption")
exit(os.EX_OK)
except BaseException:
logger.exception("Unexpected error occurred")
exit(os.EX_SOFTWARE)
if __name__ == "__main__":
main()