Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys:1: RuntimeWarning: coroutine 'main' was never awaited #16

Open
simjak opened this issue Aug 24, 2023 · 1 comment
Open

sys:1: RuntimeWarning: coroutine 'main' was never awaited #16

simjak opened this issue Aug 24, 2023 · 1 comment

Comments

@simjak
Copy link

simjak commented Aug 24, 2023

<coroutine object main at 0x1034b0f40>
sys:1: RuntimeWarning: coroutine 'main' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
@Avejack
Copy link

Avejack commented Aug 24, 2023

The problem is in the pyproject.toml the script is described as follows:

[tool.poetry.scripts]
beebot = 'beebot.initiator.cli:main'

Which means the async function main from cli.py gets executed when running the command poetry run beebot. To fix it for now, you can make main sync and let it call async_main async like this:

cli.py last part with the main function to this:

async def async_main():
    load_dotenv()
    parsed_args = parse_args()
    if parsed_args.task:
        task = parsed_args.task
    else:
        print("What would you like me to do?")
        print("> ", end="")
        task = input()

    config = Config.global_config()
    config.setup_logging()
    await initialize_db(config.database_url)

    body = Body(task=task, config=config)
    await body.setup()
    while output := await body.cycle():
        if output.observation:
            print("\n=== Cycle Output ===")
            print(output.observation.response)


def main():
    asyncio.run(async_main())


if __name__ == "__main__":
    main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants