Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't open Sqlite db create in Python with sqlite command bash

Tags:

python

sqlite

So if I create a db in Python using the sqlite3 package:

import sqlite3
con = sqlite3.connect('test.db')

I can't open the db using the sqlite command line in bash:

sqlite test.db
Unable to open database "test": file is encrypted or is not a database

I can however connect to a db created with the sqlite command line using sqlite3 in Python.

How can I open the Python created dbs in the sqlite command line?

like image 220
Dirk Calloway Avatar asked May 05 '14 11:05

Dirk Calloway


People also ask

How do I open a SQLite database in terminal?

If you are using Linux or a Mac, open a terminal window instead a command prompt. Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.

Why SQLite Cannot open database file?

If SQLite is unable to open the database file, this means that the SQLite database you are trying to open is corrupted. There are various causes of corruption, such as file overwrite issues, file locking issues, database synchronization failures, storage media failures, and many more.


1 Answers

Install sqlite3 and use sqlite3 test.db in bash.

like image 147
furas Avatar answered Sep 19 '22 16:09

furas