Skip to content

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

Catch SyntaxError as well when importing manhole

Konstantin Lopuhin17e9914b8a12
diff --git a/requirements-py3.txt b/requirements-py3.txt
index b941fd867..b38c4cc09 100644
--- a/requirements-py3.txt
+++ b/requirements-py3.txt
@@ -1,4 +1,4 @@
-git+https://github.com/lopuhin/twisted.git@9384-remove-async-param
+Twisted>=17.9.0
lxml>=3.2.4
pyOpenSSL>=0.13.1
cssselect>=0.9
diff --git a/scrapy/extensions/telnet.py b/scrapy/extensions/telnet.py
index e78afa1fc..7cc8f823a 100644
--- a/scrapy/extensions/telnet.py
+++ b/scrapy/extensions/telnet.py
@@ -12,7 +12,7 @@ try:
from twisted.conch import manhole, telnet
from twisted.conch.insults import insults
TWISTED_CONCH_AVAILABLE = True
-except ImportError:
+except (ImportError, SyntaxError):
TWISTED_CONCH_AVAILABLE = False
from scrapy.exceptions import NotConfigured
@@ -40,7 +40,8 @@ class TelnetConsole(protocol.ServerFactory):
if not crawler.settings.getbool('TELNETCONSOLE_ENABLED'):
raise NotConfigured
if not TWISTED_CONCH_AVAILABLE:
- raise NotConfigured
+ raise NotConfigured('TelnetConsole not enabled: failed to import '
+ 'required twisted modules.')
self.crawler = crawler
self.noisy = False
self.portrange = [int(x) for x in crawler.settings.getlist('TELNETCONSOLE_PORT')]