Python Sqlite3 Disk I/o Error
Contents |
this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ sqlite3.OperationalError: disk I/O error Hello, I have a piece of sqlite disk io error code that works fine on my desktop in cygwin, but fails on sql error disk i o error our server. I am creating a simple database using the sqlite3 module in python. I open a
Sqliteexception Disk I/o Error
connection con=sqlite3.connect("./file.db") #works cur=con.cursor() #works cur.execute("""create table test(name, age)""") #fails on server, works on desktop the result: An empty file.db is created, and I get "sqlite3.OperationalError: disk I/O error"
Sqlite3.operationalerror: Disk I/o Error Ipython
on the execute command. If I use ":memory:", the command works fine. For some reason, it is having trouble writing to the disk. The disk is actually some networked file system; not sure if that matters. Thanks, Kerry _______________________________________________ sqlite-users mailing list [hidden email] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users Roger Binns Reply | Threaded Open this post in threaded view ♦ ♦ | some kind of disk i/o error occurred Report Content as Inappropriate ♦ ♦ Re: sqlite3.OperationalError: disk I/O error -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/03/2011 03:05 PM, Dungan, Kerry wrote: > the result: > An empty file.db is created, and I get "sqlite3.OperationalError: disk I/O error" on the execute command. There could be any number of reasons. The message is coming from the SQLite library and it is doing that because of something that happened with the operating system. My best guess is that the journal can't be created for some reason. The server may have extra security rules, quotas etc causing this. The easiest way to find the problem is to run the program under strace which will show every system call made and the response. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk6KO5EACgkQmOOfHg372QT59gCgsGUnfKkN0XvZoEB6ULgV1tQL 1YoAn3GNFXbOwyYQpJ6/VAO0rErdGWZA =6WFN -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list [hidden email] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users Dungan, Kerry Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: sqlite3.OperationalError: disk I/O error Thanks for the advice
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the
Sqlite_ioerr Some Kind Of Disk I O Error Occurred Disk I O Error
workings and policies of this site About Us Learn more about sqlite on nfs Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions sqlite_open_fileprotection_none Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. http://sqlite.1065341.n5.nabble.com/sqlite3-OperationalError-disk-I-O-error-td18568.html Join them; it only takes a minute: Sign up Error: disk I/O error on a newly created database up vote 0 down vote favorite I'm trying to create a new database using sqlite but I keep getting the following error: sqlite3 new.db SQLite version 3.3.6 Enter ".help" for instructions sqlite> begin immediate; SQL error: database is locked I tried http://stackoverflow.com/questions/29244788/error-disk-i-o-error-on-a-newly-created-database building the latest sqlite from source and I get the following error: sqlite3 new.db SQLite version 3.8.8.3 2015-02-25 13:29:11 Enter ".help" for usage hints. Error: disk I/O error I have free disk space and I tried creating a copy of database file as suggested in disk I/O error with SQLite but without any luck. All solutions to similar questions point to an issue where the database is locked by another process. But that shouldn't happen in this case. It looks like an environment problem, but I don't have any idea about the source of this problem. Has anyone come across something similar? EDIT: This error was caused by the filesystem. The filesystem in question was an older version and evidently it didn't support cluster locking. There are many other SO questions regarding sqlite databases on nfs. sqlite sqlite3 share|improve this question edited May 2 '15 at 0:53 asked Mar 24 '15 at 23:27 Diljot 286 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote Depending on the distribution
gone offline. I checked the error log, which is filled nonstop with lines like this: 2013-06-24 17:59:00,764 :Traceback (most recent call last): 2013-06-24 17:59:00,764 :sqlite3.OperationalError: unable to open database file 2013-06-24 17:59:01,813 :Traceback (most recent call last): 2013-06-24 https://www.pythonanywhere.com/forums/topic/723/ 17:59:01,814 :sqlite3.OperationalError: unable to open database file Digging back further in the error log, I found http://www.stevemcarthur.co.uk/blog/post/some-kind-of-disk-io-error-occurred-sqlite this: OperationalError: disk I/O error 2013-06-24 12:09:15,749 :IOError: write error So, what happened? Did my app suddenly lose write permissions? zauberparacelsus | 12 posts | June 24, 2013, 6:02 p.m. | permalink Do you know the name of your sqlite file? Could you check it still exists and hasn't been deleted. If it's still there, could you check the permissions. Also, could you fire disk i up a python console and try opening the database directly and see if that works. Thanks rcs1000 | 292 posts | June 25, 2013, 7:05 a.m. | permalink Good advice from @rcs1000. Will follow up by email, but here is some general advice, in case anyone else has a similar problem: check you haven't maxed out your quota make sure you specify an absolute path to your database -- you can never be sure what the working directory for a disk i/o error web app is. try reloading your web app, as rcs1000 says, try accessing the database from a console -- sqlite3 /path/to/my.db, then .tables or select * from mytable or some insert into commands to check that data is there, and that you can insert new data. try (temporarily?) creating a new database file and switching to that. harry | 1872 posts | PythonAnywhere staff| | June 25, 2013, 10:24 a.m. | permalink Thanks for the reply. The problem was fixed by changing to absolute path, as you suggested. However, I still find this breakage strange because for the past couple of weeks it worked without a problem, and then suddenly ceased working overnight, a few days after the system upgrades. zauberparacelsus | 12 posts | June 25, 2013, 2:20 p.m. | permalink Definitely a bit strange... You might consider switching to MySQL if you need a more serious database? harry | 1872 posts | PythonAnywhere staff| | June 25, 2013, 2:58 p.m. | permalink The current working directory of a web app might well change after system updates. Remember, your web app isn't run by you directly, it's invoked by the framework that the PA infrastructure provides. It's entirely possible that the PA devs make changes to the infrastructure which, as a side-effect, changes the current running directory in which the script is run. For example, I wonder if the recent upgrade to an Ubuntu-based system might ha
today. This was a big SQLite show stopper. So I thought it was about time I figured out what was causing this. The error was occurring when I tried to post an update to the SQLite database in the local App_Data folder of an asp.net application. As soon as the application attempted to post the update I got the dreaded "Some kind of.." error and a SQLite journal file was created in the database folder. After this, the database became unavailable. It became available again once the journal file was deleted, but I was then back in the same situation once another update was attempted. The curious thing was that this behaviour didn't occur in the development environment, only when uploaded to the live server. My first thought was that the application for some reason didn't have rights to write to the App_Data folder. But the journal file was writing to the location with no troubles. Finally I hit upon a forum post on the System.Data.SQLite forum. This pointed in the direction of using the statement to set the journal_mode value to something other than "DELETE". The PRAGMA statement is executed exactly like a query, so all that needs to be done is to execute the statement using a SQLiteCommand object in the same way you would execute any other SQL statement. using(SQLiteConnection conn = new SQLiteConnection(sqliteConnectionString)) { conn.Open(); SQLiteCommand cmd = new SQLiteCommand(); cmd.Connection = conn; string pragma = "PRAGMA journal_mode = OFF"; cmd.CommandText = pragma; cmd.ExecuteNonQuery(); } Share this Post: Node.js Ajax basics Please enable JavaScript to view the comments powered by Disqus. comments powered by Disqus Copyrights © 2016 All Rights Reserved by Steve McArthur. Privacy Policy [emailprotected]