Skip to content

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

Don't fail if twisted is not available on scrapy/__init__.py, to avoid making setup.py depend on Twisted. Closes #256

Pablo Hoffman4bbcbd7b7774
diff --git a/scrapy/__init__.py b/scrapy/__init__.py
index 2c7539bcf..d0401c281 100644
--- a/scrapy/__init__.py
+++ b/scrapy/__init__.py
@@ -16,8 +16,11 @@ warnings.filterwarnings('ignore', category=DeprecationWarning, module='twisted')
# prevents noisy (and innocent) dropin.cache errors when loading spiders from
# egg files using the old Spider Manager. TODO: Remove for Scrapy 0.11
-from twisted.python.zippath import ZipPath
-ZipPath.setContent = lambda x, y: None
+try:
+ from twisted.python.zippath import ZipPath
+ ZipPath.setContent = lambda x, y: None
+except ImportError: # to avoid making setup.py depend on Twisted
+ pass
# monkey patches to fix external library issues
from scrapy.xlib import twisted_250_monkeypatches, urlparse_monkeypatches