-
-
Notifications
You must be signed in to change notification settings - Fork 121
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I got this error:
File "/Users/simon/Dropbox/Development/openai-to-sqlite/openai_to_sqlite/cli.py", line 27, in embeddings
rows, _ = rows_from_file(input)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/simon/.local/share/virtualenvs/openai-to-sqlite-jt4obeb2/lib/python3.11/site-packages/sqlite_utils/utils.py", line 305, in rows_from_file
first_bytes = buffered.peek(2048).strip()
^^^^^^^^^^^^^^^^^^^
From this code:
@cli.command()
@click.argument(
"db_path",
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
)
@click.option(
"-i",
"--input",
type=click.File("r"),
default="-",
)
def embeddings(db_path, input):
"Store embeddings for one or more text documents"
click.echo("Here is some output")
db = sqlite_utils.Database(db_path)
rows, _ = rows_from_file(input)
print(list(rows))
The error went away when I changed it to type=click.File("rb")
.
This should either be called out in the documentation or rows_from_file()
should be fixed to handle text-mode files in addition to binary files.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working