Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

fix start_python_console() to work with IPython >= 0.11. closes #335

Pablo Hoffman3191a0856003
diff --git a/scrapy/utils/console.py b/scrapy/utils/console.py
index 9edf36e39..c376ed059 100644
--- a/scrapy/utils/console.py
+++ b/scrapy/utils/console.py
@@ -11,7 +11,10 @@ def start_python_console(namespace=None, noipython=False):
if noipython:
raise ImportError
import IPython
- shell = IPython.Shell.IPShellEmbed(argv=[], user_ns=namespace)
+ try:
+ shell = IPython.embed(user_ns=namespace)
+ except AttributeError:
+ shell = IPython.Shell.IPShellEmbed(argv=[], user_ns=namespace)
shell()
except ImportError:
import code