ipython / ipython/ipython

Unable to open a second instance of IPython

Open
#1,342 11 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
16.8k
Forks
4.5k
Avg merge
1d 2h
Merged PRs (30d)
6

Description

I am getting the following error when trying to open a new iPython instance:

```
$ ipython --pylab
Traceback (most recent call last):
File "/usr/bin/ipython", line 9, in
load_entry_point('ipython==0.12', 'console_scripts', 'ipython')()
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 402, in launch_new_instance
app.initialize()
File "", line 2, in initialize
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 312, in initialize
self.init_shell()
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 332, in init_shell
ipython_dir=self.ipython_dir)
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/config/configurable.py", line 318, in instance
inst = cls(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/frontend/terminal/interactiveshell.py", line 183, in __init__
user_module=user_module, custom_exceptions=custom_exceptions
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/core/interactiveshell.py", line 431, in __init__
self.init_history()
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/core/interactiveshell.py", line 1439, in init_history
self.history_manager = HistoryManager(shell=self, config=self.config)
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/core/history.py", line 407, in __init__
self.new_session()
File "", line 2, in new_session
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/core/history.py", line 61, in needs_sqlite
return f(*a,**kw)
File "/usr/lib/python2.7/site-packages/ipython-0.12-py2.7.egg/IPython/core/history.py", line 425, in new_session
NULL, "") """, (datetime.datetime.now(),))
OperationalError: database is locked

If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org
```

This happens when the other iPython session is executing a particularly lengthy command, but not when it is idle. When I try to run something inside an already open session while a command is running in a separate session, I get:

```
The history saving thread hit an unexpected error (OperationalError('database is locked',)).History will not be written to the database.
```

The cause is obvious, but it seems to me that the functionality is broken... History commands generated while the db is locked should probably be added to a queue to be submitted once the lock is removed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.