Skip to content

Commit 2c8e573

Browse files
eliasdornelesdangra
authored andcommitted
fix IPython shell scope issue and load IPython user config
1 parent c84c376 commit 2c8e573

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scrapy/utils/console.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ def start_python_console(namespace=None, noipython=False, banner=''):
1313
raise ImportError()
1414

1515
try:
16-
try:
17-
from IPython.terminal import embed
18-
except ImportError:
19-
from IPython.frontend.terminal import embed
20-
sh = embed.InteractiveShellEmbed(banner1=banner)
16+
from IPython.terminal.embed import InteractiveShellEmbed
17+
from IPython.terminal.ipapp import load_default_config
2118
except ImportError:
22-
from IPython.Shell import IPShellEmbed
23-
sh = IPShellEmbed(banner=banner)
19+
from IPython.frontend.terminal.embed import InteractiveShellEmbed
20+
from IPython.frontend.terminal.ipapp import load_default_config
2421

25-
sh(global_ns={}, local_ns=namespace)
22+
config = load_default_config()
23+
shell = InteractiveShellEmbed(
24+
banner1=banner, user_ns=namespace, config=config)
25+
shell()
2626
except ImportError:
2727
import code
2828
try: # readline module is only available on unix systems

0 commit comments

Comments
 (0)