Skip to content

Commit 3191a08

Browse files
committed
fix start_python_console() to work with IPython >= 0.11. closes scrapy#335
1 parent 18cb4ff commit 3191a08

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scrapy/utils/console.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ def start_python_console(namespace=None, noipython=False):
1111
if noipython:
1212
raise ImportError
1313
import IPython
14-
shell = IPython.Shell.IPShellEmbed(argv=[], user_ns=namespace)
14+
try:
15+
shell = IPython.embed(user_ns=namespace)
16+
except AttributeError:
17+
shell = IPython.Shell.IPShellEmbed(argv=[], user_ns=namespace)
1518
shell()
1619
except ImportError:
1720
import code

0 commit comments

Comments
 (0)