Skip to content

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

Improved Twisted version detection (wasn't working for Twisted 10.0.0)

Pablo Hoffman747f090f941b
diff --git a/scrapy/xlib/twisted_250_monkeypatches.py b/scrapy/xlib/twisted_250_monkeypatches.py
index 1395161c8..56dc93f31 100644
--- a/scrapy/xlib/twisted_250_monkeypatches.py
+++ b/scrapy/xlib/twisted_250_monkeypatches.py
@@ -41,7 +41,8 @@ def add_missing_blockingCallFromThread():
try:
import twisted
- if twisted.__version__ < '8.0.0':
+ from twisted.python.versions import Version
+ if twisted.version < Version("twisted", 8, 0, 0):
add_missing_blockingCallFromThread()
except ImportError:
pass