Skip to content

Commit

Permalink
Fix scrapy#396 re-triggered issue
Browse files Browse the repository at this point in the history
The InteractiveShellEmbed class is a singleton
and we need to drop the instance with its clear_instance() method
to rebuild the instance from scratch with fresh environment
for each subsequent drop in.
  • Loading branch information
ahlinc committed Nov 30, 2016
1 parent a07400c commit e61d213
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scrapy/utils/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def wrapper(namespace=namespace, banner=''):
config = load_default_config()
# Always use .instace() to ensure _instance propagation to all parents
# this is needed for <TAB> completion works well for new imports
# and clear the instance to always have the fresh env
# on repeated breaks like with inspect_response()
InteractiveShellEmbed.clear_instance()
shell = InteractiveShellEmbed.instance(
banner1=banner, user_ns=namespace, config=config)
shell()
Expand Down

0 comments on commit e61d213

Please sign in to comment.