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

Linux: EOFError when asking input after async input #19

Closed
plammens opened this issue Jun 8, 2022 · 0 comments · Fixed by #23 · May be fixed by #22
Closed

Linux: EOFError when asking input after async input #19

plammens opened this issue Jun 8, 2022 · 0 comments · Fixed by #23 · May be fixed by #22

Comments

@plammens
Copy link
Owner

plammens commented Jun 8, 2022

For example, when connecting to the server, if the connection fails, we use ainput():

choice = await async_ask_valid_input(
"What would you like to do? ("
"RETRY: retry connecting to this server; "
"RESTART: restart Love Letter CLI (go back to username selection); "
"QUIT: quit Love Letter CLI"
")",
choices=ConnectionErrorOptions,
default=ConnectionErrorOptions.RETRY,
)

If the user selects restart, an EOFError will ensue, because the start screen uses regular input() to ask for a username:
username = ask_valid_input("Enter your username: ", parser=parser)

This is directly due to vxgmichel/aioconsole#99 .


Possible solutions seem to be one of the following:

  • Only use regular input() everywhere
  • Only use ainput() everywere
  • Disable ainput() only on certain operating systems (e.g. Linux)
  • Wait for a fix on aioconsole, or patch ainput locally
plammens added a commit that referenced this issue Jun 8, 2022
This is to avoid conflicts with blocking IO, i.e. input() and print().
On Linux ainput() sets the O_NONBLOCK flag, which then makes input() and print() fail.

Fixes #17, #19
plammens added a commit that referenced this issue Jun 8, 2022
This is to ensure we can still use regular blocking IO such as
input() and print() after using ainput.

Fixes #17, #19
plammens added a commit that referenced this issue Jun 8, 2022
This is to avoid conflicts with blocking IO, i.e. input() and print().
On Linux ainput() sets the O_NONBLOCK flag, which then makes input() and print() fail.

Fixes #17, #19
plammens added a commit that referenced this issue Jun 8, 2022
This is to ensure we can still use regular blocking IO such as
input() and print() after using ainput.

Fixes #17, #19
plammens added a commit that referenced this issue Jun 11, 2022
This is to ensure we can still use regular blocking IO such as
input() and print() after using ainput.

Fixes #17, #19
plammens added a commit that referenced this issue Jun 11, 2022
This is to ensure we can still use regular blocking IO such as
input() and print() after using ainput.

Fixes #17, #19
plammens added a commit that referenced this issue Jan 10, 2023
This is to ensure we can still use regular blocking IO such as
input() and print() after using ainput.

Fixes #17, #19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant