From 6f50cf55a4ded1de1238a71b4dac7ebd85f07a75 Mon Sep 17 00:00:00 2001 From: Elias Dorneles Date: Wed, 13 Aug 2014 21:39:31 -0300 Subject: [PATCH] fix IPython shell scope issue and load IPython user config --- scrapy/utils/console.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scrapy/utils/console.py b/scrapy/utils/console.py index 5dd4539edae..92450100271 100644 --- a/scrapy/utils/console.py +++ b/scrapy/utils/console.py @@ -13,16 +13,16 @@ def start_python_console(namespace=None, noipython=False, banner=''): raise ImportError() try: - try: - from IPython.terminal import embed - except ImportError: - from IPython.frontend.terminal import embed - sh = embed.InteractiveShellEmbed(banner1=banner) + from IPython.terminal.embed import InteractiveShellEmbed + from IPython.terminal.ipapp import load_default_config except ImportError: - from IPython.Shell import IPShellEmbed - sh = IPShellEmbed(banner=banner) + from IPython.frontend.terminal.embed import InteractiveShellEmbed + from IPython.frontend.terminal.ipapp import load_default_config - sh(global_ns={}, local_ns=namespace) + config = load_default_config() + shell = InteractiveShellEmbed( + banner1=banner, user_ns=namespace, config=config) + shell() except ImportError: import code try: # readline module is only available on unix systems