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

llm 0.14: Can't run <<llm chat>> on Windows 11 #495

Closed
rsbohn opened this issue May 15, 2024 · 3 comments
Closed

llm 0.14: Can't run <<llm chat>> on Windows 11 #495

rsbohn opened this issue May 15, 2024 · 3 comments

Comments

@rsbohn
Copy link

rsbohn commented May 15, 2024

Description:
After upgrading from version 0.13, the following lines of code fail to execute on a Windows 11 environment:

readline.parse_and_bind("\\e[D: backward-char")
readline.parse_and_bind("\\e[C: forward-char")

This issue appears to be specific to Windows. On non-Windows platforms, these lines work as expected.

Steps to Reproduce:

  1. Upgrade from version 0.13 to the latest version on a Windows 11 machine.
  2. Execute code containing the lines:
    readline.parse_and_bind("\\e[D: backward-char")
    readline.parse_and_bind("\\e[C: forward-char")

Observed Behavior:
The code fails on Windows 11, leading to errors or unexpected behavior.

IndexError: Not a valid key: '\e[d'

Workaround Implemented:
I have temporarily resolved the issue using a platform check to ensure this code doesn't execute on Windows. Here is the workaround:

import os
import readline

if os.name != 'nt':
    readline.parse_and_bind("\\e[D: backward-char")
    readline.parse_and_bind("\\e[C: forward-char")

Relevant Code:
The relevant section of the code can be found at this link to cli.py, line 345.

Environment:

  • OS: Windows 11
  • Version affected: Latest version after 0.13

Expected Behavior:
The code should work across all platforms, including Windows 11, without requiring modifications.

@rsbohn
Copy link
Author

rsbohn commented May 15, 2024

See also 1a4853d

@designcomputer
Copy link

Thanks. This is a good temporary fix for the issue with 0.14 on Windows.

@rsbohn
Copy link
Author

rsbohn commented Jul 19, 2024

Still a problem in 0.15.

simonw added a commit that referenced this issue Dec 1, 2024
 (#646)

* Fix windows bug where llm doesn't run <<llm chat>> on Windows issue #495

* Applied Black

---------

Co-authored-by: Sukhbinder Singh <sukhbindersingh@gmail.com>
Co-authored-by: Simon Willison <swillison@gmail.com>
simonw added a commit that referenced this issue Dec 1, 2024
@simonw simonw closed this as completed Dec 2, 2024
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

3 participants