3 ms·
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 sh
by anotherpaulg 2y ago
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/ https://pexpect.readthedocs.io/en/stable/
[1] https://x.com/paulgauthier/status/1827012590406607040 https://x.com/paulgauthier/status/1827012590406607040
- geekodour 2y agowait 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
- anotherpaulg 2y agoThere’s a little demo video in the Twitter link that might be worth checking out. But ya, aider can: code something for you, run it, capture the terminal output with pexpect and iterate further based on that.
- firesteelrain 2y agoThe 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.