Ipython: provide information how to handle "sqlite3.OperationalError: attempt to write a readonly database" in exception message

Created on 1 Jan 2014  Â·  4Comments  Â·  Source: ipython/ipython

I'm experiencing an sqlite3.OperationalError: attempt to write a readonly database
(stack trace attached). As this seems to be an error related to a database connection, the error message could be more precise (which is my enhancement request), specifying the failed connection parameters (at least host and port). It is not clear what the program expects thought it could be.

stacktrace

Error in sys.excepthook:
Traceback (most recent call last):
File "/mnt/DATA/sources/ipython/IPython/core/application.py", line 175, in excepthook
return self.crash_handler(etype, evalue, tb)
File "/mnt/DATA/sources/ipython/IPython/core/crashhandler.py", line 158, in call
traceback = TBhandler.text(etype,evalue,etb,context=31)
File "/mnt/DATA/sources/ipython/IPython/core/ultratb.py", line 412, in text
tb_offset, context)
File "/mnt/DATA/sources/ipython/IPython/core/ultratb.py", line 963, in structured_traceback
ipinst = ipapi.get()
File "/mnt/DATA/sources/ipython/IPython/core/ipapi.py", line 28, in get
return InteractiveShell.instance()
File "/mnt/DATA/sources/ipython/IPython/config/configurable.py", line 318, in instance
inst = cls(_args, _kwargs)
File "/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py", line 436, in init
self.init_history()
File "/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py", line 1489, in init_history
self.history_manager = HistoryManager(shell=self, config=self.config)
File "/mnt/DATA/sources/ipython/IPython/core/history.py", line 409, in init
self.new_session()
File "", line 2, in new_session
File "/mnt/DATA/sources/ipython/IPython/core/history.py", line 60, in needs_sqlite
return f(_a,_
kw)
File "/mnt/DATA/sources/ipython/IPython/core/history.py", line 427, in new_session
NULL, "") """, (datetime.datetime.now(),))
sqlite3.OperationalError: attempt to write a readonly database

Original exception was:
Traceback (most recent call last):
File "/usr/bin/ipython", line 7, in
launch_new_instance()
File "/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py", line 388, in launch_new_instance
app.initialize()
File "", line 2, in initialize
File "/mnt/DATA/sources/ipython/IPython/config/application.py", line 84, in catch_config_error
return method(app, _args, _kwargs)
File "/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py", line 324, in initialize
self.init_shell()
File "/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py", line 340, in init_shell
ipython_dir=self.ipython_dir)
File "/mnt/DATA/sources/ipython/IPython/config/configurable.py", line 318, in instance
inst = cls(_args, *_kwargs)
File "/mnt/DATA/sources/ipython/IPython/frontend/terminal/interactiveshell.py", line 360, in init
user_module=user_module, custom_exceptions=custom_exceptions
File "/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py", line 436, in init
self.init_history()
File "/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py", line 1489, in init_history
self.history_manager = HistoryManager(shell=self, config=self.config)
File "/mnt/DATA/sources/ipython/IPython/core/history.py", line 409, in init
self.new_session()
File "", line 2, in new_session
File "/mnt/DATA/sources/ipython/IPython/core/history.py", line 60, in needs_sqlite
return f(_a,_
kw)
File "/mnt/DATA/sources/ipython/IPython/core/history.py", line 427, in new_session
NULL, "") """, (datetime.datetime.now(),))
sqlite3.OperationalError: attempt to write a readonly database

output of python -c "import IPython; print(IPython.sys_info())":

{'commit_hash': '858d539',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/usr/local/lib/python2.7/dist-packages/IPython',
'ipython_version': '0.13.2',
'os_name': 'posix',
'platform': 'Linux-3.11.0-14-generic-x86_64-with-Ubuntu-13.10-saucy',
'sys_executable': '/usr/bin/python',
'sys_platform': 'linux2',
'sys_version': '2.7.5+ (default, Sep 19 2013, 13:48:49) n[GCC 4.8.1]'}

It would be nice to have a possibility to attach files to the issue report and to be able to search the already committed issues (!!).

Most helpful comment

I tried this and it worked. Thank you @takluyver, @richtekp.

~/.ipython/profile_default/history.sqlite
/Users/ChessTastic/.ipython/profile_default/history.sqlite.
➜  profile_default  sudo chmod a+w history.sqlite
Password:

All 4 comments

sqlite uses a file, not a database server. By default, it will be saving in ~/.ipython/profile_default/history.sqlite. Does that file exist, and is it writable?

Thanks for the hint! The file had the wrong permissions (not writable). I suggest to improve error message/output.

It would be nice to have a possibility to attach files to the issue report

It is common to use gists.

and to be able to search the already committed issues (!!).

The search field is located at the top of the page.

I tried this and it worked. Thank you @takluyver, @richtekp.

~/.ipython/profile_default/history.sqlite
/Users/ChessTastic/.ipython/profile_default/history.sqlite.
➜  profile_default  sudo chmod a+w history.sqlite
Password:
Was this page helpful?
0 / 5 - 0 ratings

Related issues

henryiii picture henryiii  Â·  3Comments

quchunguang picture quchunguang  Â·  3Comments

sataliulan picture sataliulan  Â·  4Comments

mpacer picture mpacer  Â·  3Comments

frenzymadness picture frenzymadness  Â·  3Comments