Home > database >  Sqlite3. OperationalError: disk I/O error
Sqlite3. OperationalError: disk I/O error

Time:05-01

In the container to start the python project, the project USES an sqlite3 database, you can view the database data, write data will be submitted to the sqlite3. OperationalError: disk I/O error this error, according to the baidu, a lot of ways, to the store. The db file directory is changed in order to can read can write permissions, still not, create a simple demo also appear the same mistake, the demo is as follows:
 
# import sqllite3 moduleThe import sqlite3
# 1. The hard disk to create a connection
Con=sqlite3. Connect ('./data/test/demo db)
# get cursor objects
Cur=con. Cursor ()
# execute SQL to create table
='the create table SQL t_person (pno INTEGER PRIMARY KEY AUTOINCREMENT, pname varchar (30) NOT NULL, the age INTEGER)'
# the try:
# cur. Execute (SQL)
# the except Exception as e:
# print (e)
# print (' failed to create table ')
# the finally:
# # close the cursor
# cur. Close ()
# # closes the connection
# con. The close ()
Cur. Execute (SQL)
Cur. Close ()
Con. The close ()


 Traceback (the most recent call last) : 
The File "demo. Py, line 19, in & lt; module>
Cur. Execute (SQL)
Sqlite3. OperationalError: disk I/O error


Have bosses know how to deal with this problems:
  • Related