From 38332a8a909246af1fde2e984098166f4a428405 Mon Sep 17 00:00:00 2001 From: Trygve Date: Sun, 13 Mar 2022 17:33:26 +0100 Subject: [PATCH] =?UTF-8?q?Start=20p=C3=A5=20asyncio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- event_mgr.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/event_mgr.py b/event_mgr.py index ed98dff..355600c 100644 --- a/event_mgr.py +++ b/event_mgr.py @@ -1,5 +1,7 @@ import otime import pickle +import asyncio +from watchgod import awatch from config import config from rich import print from rich import inspect @@ -7,7 +9,7 @@ from rich.console import Console from rich.columns import Columns from rich.table import Table -def main(): +def start(): event = otime.event(0, config['event_name']) event.import_ttime_cnf('/home/trygve/Documents/sprintcup040330/sprintcup040330.cnf') event.import_ttime_db(config['db_file']) @@ -15,5 +17,9 @@ def main(): event.match_runners_cards() event.get_xml_res().write(config['xml_res_file']) +async def main(): + async for changes in awatch(config['db_file']): + print(changes) if __name__ == "__main__": - main() + start() + asyncio.run(main())