From 9bf4663b9e537edefa8de06a5670a1e2ff3071d1 Mon Sep 17 00:00:00 2001 From: profitroll Date: Sun, 12 Mar 2023 22:58:55 +0100 Subject: [PATCH] Made execution order correct --- modules/cli.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/cli.py b/modules/cli.py index 2ea0be4..0e4768e 100644 --- a/modules/cli.py +++ b/modules/cli.py @@ -26,7 +26,7 @@ async def cli_create_user() -> None: email = input(f"Choose email for user '{username}': ").strip() password = input(f"Choose password for user '{username}': ").strip() try: - result = await create_user(username, email, password) + result_1 = await create_user(username, email, password) # asyncio.run(create_user(username, email, password)) configSet("username", username, "posting", "api") configSet("password", password, "posting", "api") @@ -41,6 +41,7 @@ async def cli_create_user() -> None: print("You're done!", flush=True) await http_session.close() exit() + return None async def cli_create_album() -> None: @@ -51,7 +52,7 @@ async def cli_create_album() -> None: name = input("Choose a name for your album: ").strip() title = input(f"Choose a title for album '{name}': ").strip() try: - result = await create_album(name, title) + result_2 = await create_album(name, title) # asyncio.run(create_album(name, title)) configSet("album", name, "posting", "api") except Exception as exp: @@ -61,6 +62,7 @@ async def cli_create_album() -> None: print("You're done!", flush=True) await http_session.close() exit() + return None if args.create_user or args.create_album: @@ -68,10 +70,9 @@ if args.create_user or args.create_album: tasks = [] if args.create_user: - tasks.append(loop.create_task(cli_create_user())) + loop.run_until_complete(asyncio.wait([loop.create_task(cli_create_user())])) if args.create_album: - tasks.append(loop.create_task(cli_create_album())) + loop.run_until_complete(asyncio.wait([loop.create_task(cli_create_album())])) - loop.run_until_complete(asyncio.wait(tasks)) loop.close()