ipython/ipython — Issue #1197: Interactive shell trying to: from ... import history
Author: holmboe
Created: 2011-12-22 14:52:48+00:00
State: open

```python
$ ipython3
Traceback (most recent call last):
File "/home/hh/.virtualenvs/sweddoc4/bin/ipython3", line 9, in
load_entry_point('ipython==0.12', 'console_scripts', 'ipython3')()
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/frontend/terminal/ipapp.py", line 402, in launch_new_instance
app.initialize()
File "", line 2, in initialize
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/frontend/terminal/ipapp.py", line 312, in initialize
self.init_shell()
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/frontend/terminal/ipapp.py", line 332, in init_shell
ipython_dir=self.ipython_dir)
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/config/configurable.py", line 318, in instance
inst = cls(*args, **kwargs)
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/frontend/terminal/interactiveshell.py", line 183, in __init__
user_module=user_module, custom_exceptions=custom_exceptions
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/core/interactiveshell.py", line 480, in __init__
self.init_magics()
File "/home/hh/.virtualenvs/sweddoc4/lib/python3.1/site-packages/IPython/core/interactiveshell.py", line 1957, in init_magics
from ... import history
ValueError: Attempted relative import beyond toplevel package
```

The attached patch makes it possible to start ipython3.

```
--- interactiveshell.py.orig	2011-12-22 15:50:57.000000000 +0100
+++ interactiveshell.py	2011-12-22 15:47:39.000000000 +0100
@@ -1954,7 +1954,7 @@
# even need a centralize colors management object.
self.magic_colors(self.colors)
# History was moved to a separate module
- from ... import history
+ from IPython.core import history
history.init_ipython(self)

def magic(self, arg_s, next_input=None):
```