From 4bbcbd7b77748bb073841b627fa9de388ee72da6 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Tue, 5 Oct 2010 12:43:34 -0200 Subject: [PATCH] Don't fail if twisted is not available on scrapy/__init__.py, to avoid making setup.py depend on Twisted. Closes #256 --- scrapy/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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