Skip to content

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

Move an import to postpone another "import twisted.internet.reactor".

Andrey Rakhmatullin97fb61cec846
diff --git a/scrapy/commands/shell.py b/scrapy/commands/shell.py
index e05084272..7516e2aba 100644
--- a/scrapy/commands/shell.py
+++ b/scrapy/commands/shell.py
@@ -6,7 +6,6 @@ See documentation in docs/topics/shell.rst
from threading import Thread
from scrapy.commands import ScrapyCommand
-from scrapy.shell import Shell
from scrapy.http import Request
from scrapy.utils.spider import spidercls_for_request, DefaultSpider
from scrapy.utils.url import guess_scheme
@@ -70,6 +69,8 @@ class Command(ScrapyCommand):
self._start_crawler_thread()
+ # moved from the top-level because it imports twisted.internet.reactor
+ from scrapy.shell import Shell
shell = Shell(crawler, update_vars=self.update_vars, code=opts.code)
shell.start(url=url, redirect=not opts.no_redirect)