simonw / simonw/llm

Exception ignored in: <_io.TextIOWrapper name=4 mode='w' encoding='UTF-8'>

Open
#665 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12.5k
Forks
991
Avg merge
3d 13h
Merged PRs (30d)
10

Description

Hello,

I keep getting the same error when trying to use the llm CLI. Is this a bug in the software, an issue with the file I have created, or something else?

This is the error that displays in the terminal (iterm on mac os).

Exception ignored in: <_io.TextIOWrapper name=4 mode='w' encoding='UTF-8'>
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/llm/0.19/libexec/lib/python3.13/site-packages/llm_gpt4all.py", line 294, in __exit__
    sys.stderr = self.original_stderr
OSError: [Errno 9] Bad file descriptor

The command I am running and its output.

cat testing.txt | llm -m Meta-Llama-3-8B-Instruct -s "Create a report summary the contents of this file"
 Report Summary %1

**Summary of the contents of this file**

This is a DNS (Domain Name System) query log output from Dig, a command-line tool for querying DNS servers. The report shows the results of a query to Google's domain name.

Here are some key points summarized:

* **Query**: The query was made to retrieve an A record (IP address) for `google.`.
* **Response**: The response indicates that no A records were found, but it did return other information about the DNS server and its configuration.
* **DNS Server Information**:
	+ The queried domain is `google.`
	+ The SOA (Start of Authority) record shows the name servers for Google's domain (`ns-1ld1.charlestonroadregistry.com`).
	+ The query took 76 milliseconds to complete.

Overall, this report provides information about DNS queries and responses, which can be useful for troubleshooting or understanding how DNS works.Exception ignored in: <_io.TextIOWrapper name=4 mode='w' encoding='UTF-8'>
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/llm/0.19/libexec/lib/python3.13/site-packages/llm_gpt4all.py", line 294, in __exit__
    sys.stderr = self.original_stderr
OSError: [Errno 9] Bad file descriptor
llm python
Python 3.13.0 (main, Oct  7 2024, 05:02:14) [Clang 16.0.0 (clang-1600.0.26.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

testing.txt

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported command, cat testing.txt | llm -m Meta-Llama-3-8B-Instruct ..., on macOS with Python 3.13. Then inspect llm_gpt4all.py at line 294, where the traceback identifies the failure. Done means the command completes without the reported Bad file descriptor exception and the relevant behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.