Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Sending enter key event doesn't work with pexpect and survey #422

Open
coinpayu opened this issue May 13, 2022 · 1 comment
Open

Sending enter key event doesn't work with pexpect and survey #422

coinpayu opened this issue May 13, 2022 · 1 comment
Labels

Comments

@coinpayu
Copy link

I am using python3's pexpect module to interact with survey.

How can I send an 'enter' key event to survey? I have tried sendline(), send('\n'), send('\r'), but all failed. It seems survey ignored them.

@mislav
Copy link
Collaborator

mislav commented May 16, 2022

Hi, I don't have experience with pexpect, but Survey interprets either \n or \r read from stdin (from the terminal, to be precise, because Survey only works when stdin is connected to a terminal) as Enter key being pressed.

if r == '\r' || r == '\n' || r == KeyEndTransmission {

If Survey ignores a keystroke that pexpect has sent, maybe something was wrong in the way pexpect was set up in your case?

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

No branches or pull requests

2 participants