Skip to content

Commit

Permalink
Don't crash if we cannot import readline (e.g. on Windows) (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum authored May 20, 2024
1 parent 1fed2c7 commit f017404
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/src/typechat/_internal/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ async def process_requests(interactive_prompt: str, input_file_name: str | None,
print(interactive_prompt + line)
await process_request(line)
else:
# Use readline to enable input editing and history
import readline # type: ignore
try:
# Use readline to enable input editing and history
import readline # type: ignore
except ImportError:
pass
while True:
try:
line = input(interactive_prompt)
Expand Down

0 comments on commit f017404

Please sign in to comment.