1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 21:04:07 +00:00

Merge pull request #856 from eliasdorneles/fix-embed-ipython-shell

fix IPython shell scope issue by using IPython.embed()
This commit is contained in:
Mikhail Korobov 2014-08-20 00:16:33 +06:00
commit c4f9e9d8e7

View File

@ -13,16 +13,16 @@ def start_python_console(namespace=None, noipython=False, banner=''):
raise ImportError()
try:
try:
from IPython.terminal import embed
from IPython.terminal.embed import InteractiveShellEmbed
from IPython.terminal.ipapp import load_default_config
except ImportError:
from IPython.frontend.terminal import embed
sh = embed.InteractiveShellEmbed(banner1=banner)
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