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
RuntimeError: This event loop is already running #30
Comments
Hi @corzani , Thanks for reporting. I'm aware of this issue at the moment. Async application is not yet officially supported yet. It is in my backlog to be supported in the near future. Stay tuned. I'll work on this possibly after the next release. Thanks, |
Sorry forgot to answer your last question. Although not well tested, but for now you can run the app async like this. import asyncio
from InquirerPy import inquirer
async def main():
prompt = inquirer.fuzzy(
message="Select actions:",
choices=["hello", "weather", "what", "whoa", "hey", "yo"],
default="he",
)
result = await prompt.application.run_async()
if __name__ == "__main__":
asyncio.run(main()) |
Thank you @kazhala |
Async execution will be included in the next release. Forgot to mention that for now, if you wish to run async for the following prompt: text, filepath, confirm, secret, you'll do the following: import asyncio
from InquirerPy import inquirer
async def main():
prompt = inquirer.confirm(message="Select actions:")
result = await prompt._session.prompt_async()
if __name__ == "__main__":
asyncio.run(main()) Internally, these are built differently than list prompts such as fuzzy. Thanks, |
@kazhala pipx install radio81 |
I am dealing with InquirerPy within an asyncio task something like:
In any case I receive this kind of error:
Is there a better way to avoid this error instead of using nest-asyncio like libraries?
The text was updated successfully, but these errors were encountered: