Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-133439: Fix the error message in the sqlite3 CLI #133807

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

Merged
merged 10 commits into from
Jun 19, 2025
6 changes: 3 additions & 3 deletions Lib/sqlite3/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def runsource(self, source, filename="<input>", symbol="single"):
if source[0] == ".":
match source[1:].strip():
case "version":
print(f"{sqlite3.sqlite_version}")
print(sqlite3.sqlite_version)
case "help":
print("Enter SQL code and press enter.")
case "quit":
Expand All @@ -70,8 +70,8 @@ def runsource(self, source, filename="<input>", symbol="single"):
pass
case _ as unknown:
t = theme.traceback
self.write(f'{t.type}Error{t.reset}:{t.message} unknown'
f'command or invalid arguments: "{unknown}".\n{t.reset}')
self.write(f'{t.type}Error{t.reset}: {t.message}unknown '
f'command: "{unknown}"{t.reset}\n')
else:
if not sqlite3.complete_statement(source):
return True
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_sqlite3/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_interact_dot_commands_unknown(self):
self.assertEndsWith(out, self.PS1)
self.assertEqual(out.count(self.PS1), 2)
self.assertEqual(out.count(self.PS2), 0)
self.assertIn("Error", err)
self.assertIn('Error: unknown command: "', err)
# test "unknown_command" is pointed out in the error message
self.assertIn("unknown_command", err)

Expand Down
Loading