Skip to content

ipython_directive causing OperationalError: attempt to write a readonly database #8850

Closed

Description

@matthew-brett

I have a minimal sphinx project generated by sphinx_quickstart and with the conf.py edited only to add:

extensions = ['IPython.sphinxext.ipython_console_highlighting',
              'IPython.sphinxext.ipython_directive']

I added a file ipy_eg.rst containing:

.. ipython::

    In [1]: x = 1

Running make html builds a correct-looking html page, but always exits with this error:

build succeeded, 1 warning.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Users/mb312/.virtualenvs/regreg/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 3394, in atexit_operations
    self.history_manager.end_session()
  File "/Users/mb312/.virtualenvs/regreg/lib/python2.7/site-packages/IPython/core/history.py", line 547, in end_session
    len(self.input_hist_parsed)-1, self.session_number))
OperationalError: attempt to write a readonly database
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/Users/mb312/.virtualenvs/regreg/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 3394, in atexit_operations
    self.history_manager.end_session()
  File "/Users/mb312/.virtualenvs/regreg/lib/python2.7/site-packages/IPython/core/history.py", line 547, in end_session
    len(self.input_hist_parsed)-1, self.session_number))
sqlite3.OperationalError: attempt to write a readonly database

I'm running ipython current master, and my history file is writeable.

$ ipython --version
4.1.0-dev
$ ls -al $(ipython locate)/profile_default/history.sqlite
-rw-r--r--  1 mb312  staff  15002624 Sep 29 21:57 /Users/mb312/.ipython/profile_default/history.sqlite

Activity

  1. jenshnielsen commented on Sep 30, 2015

    @jenshnielsen
    Contributor

    I have seen this too building the matplotlib docs. I believe it happened when upgrading to 4.0. Perhaps fixed by #8846?

  2. minrk commented on Sep 30, 2015

    @minrk
    Member

    It's probable that the directive should be using :memory: by default, anyway. I doubt people really want sphinx builds to be populating their command history.

    This wouldn't be fixed by #8846, since that only catches the creation of the session, whereas the reported traceback doesn't seem to fail until the last operation.

  3. added this to the 4.1 milestone on Oct 9, 2015
  4. minrk commented on Oct 9, 2015

    @minrk
    Member

    I think this should be fixed by #8888, which forces the history to be in-memory when using the directive.

  5. tacaswell commented on Nov 20, 2015

    @tacaswell
    Contributor

    #8405 was also an attempt to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions