Skip to content

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

More visible telnet conch message

Konstantin Lopuhin9428a4a3aa4c
diff --git a/scrapy/extensions/telnet.py b/scrapy/extensions/telnet.py
index 7cc8f823a..3024ddfaa 100644
--- a/scrapy/extensions/telnet.py
+++ b/scrapy/extensions/telnet.py
@@ -6,6 +6,7 @@ See documentation in docs/topics/telnetconsole.rst
import pprint
import logging
+import traceback
from twisted.internet import protocol
try:
@@ -13,6 +14,7 @@ try:
from twisted.conch.insults import insults
TWISTED_CONCH_AVAILABLE = True
except (ImportError, SyntaxError):
+ _TWISTED_CONCH_TRACEBACK = traceback.format_exc()
TWISTED_CONCH_AVAILABLE = False
from scrapy.exceptions import NotConfigured
@@ -40,8 +42,9 @@ class TelnetConsole(protocol.ServerFactory):
if not crawler.settings.getbool('TELNETCONSOLE_ENABLED'):
raise NotConfigured
if not TWISTED_CONCH_AVAILABLE:
- raise NotConfigured('TelnetConsole not enabled: failed to import '
- 'required twisted modules.')
+ raise NotConfigured(
+ 'TELNETCONSOLE_ENABLED setting is True but required twisted '
+ 'modules failed to import:\n' + _TWISTED_CONCH_TRACEBACK)
self.crawler = crawler
self.noisy = False
self.portrange = [int(x) for x in crawler.settings.getlist('TELNETCONSOLE_PORT')]