Live data from Hacker News

Expect – Linux tool for automating interactive programs

linux.die.net

11–20 of 92 posts

Re: Expect – Linux tool for automating interactive programs

#15
I just used python pexpect [0] for a fun project. I believe pexpect was inspired by the original Unix expect command.

I used it to let aider suggest and run shell commands [1]. This is handy, so aider can offer to run the code it just wrote for you, run migrations, install dependencies, etc.

Using pexepect makes it easy for aider to run interactive shell commands and capture their output. This allows aider to fix bugs or suggest next steps based on the command’s output, error messages, etc.

[0] https://pexpect.readthedocs.io/en/stable/

[1] https://x.com/paulgauthier/status/1827012590406607040

Re: Expect – Linux tool for automating interactive programs

#16

I just used python pexpect [0] for a fun project. I believe pexpect was inspired by the original Unix expect command. I used it to let aider suggest and run shell commands [1]. This is handy, so aider can offer to run the code it just wrote for you, run migrations, install dependencies, etc. Using pexepect makes it easy for aider to run interactive shell commands and capture their output. This allows aider to fix bug…

wait so if i understand you correctly,

1. aider makes some change 2. aider then tells itself to use pexpect to check what changes it made 3. pexpect runs, opens browser somehow captures error messages if any and feeds that back?

i am pretty sure i misunderstood something

Re: Expect – Linux tool for automating interactive programs

#19

I just used python pexpect [0] for a fun project. I believe pexpect was inspired by the original Unix expect command. I used it to let aider suggest and run shell commands [1]. This is handy, so aider can offer to run the code it just wrote for you, run migrations, install dependencies, etc. Using pexepect makes it easy for aider to run interactive shell commands and capture their output. This allows aider to fix bug…

The only problem we had with pexpect (maybe expect) was that we started to have prompts disappear or text not appear/be presented to our python script. Could have been an issue of buffers not flushing. It’s been several years but this one detail I remember because we had several workarounds for it.

Re: Expect – Linux tool for automating interactive programs

#20

As a default, I'd keep everything in one language: https://pypi.org/project/pyexpect/

I don’t think you understand nor used the program expect before

Pyexpect is in another class of software. It is a Python testing utility that provides expressive assertions for unit testing.

On the other hand, the Unix expect program, and its Python equivalent pexpect, are used for automating interactive applications.

Post reply on HN