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

ainput can't be cancelled #113

Open
samskiter opened this issue Dec 4, 2023 · 1 comment
Open

ainput can't be cancelled #113

samskiter opened this issue Dec 4, 2023 · 1 comment

Comments

@samskiter
Copy link

Similar to #104

I have a task that waits for user input but I'd like to be able to cancel that task - unfortunately is seems that I can't do that when using ainput - the cancellation is simply ignored and the program continues to wait for user input.

Or am I missing something?

@vxgmichel
Copy link
Owner

Hi @samskiter and thanks for the report :)

I just tried the following example on linux with python 3.11 and it seems to work fine:

import asyncio
import aioconsole

async def main():
    try:
        async with asyncio.timeout(3):
            print(await aioconsole.ainput())
    except TimeoutError:
        print("Timeout!")

if __name__ == "__main__":
    asyncio.run(main())

Could provide more information about your code, OS and python version?

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