Skip to content

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

removed hack for switching standard descriptors in favor of using LOG_STDOUT=False by default

Pablo Hoffman11f296b75367
diff --git a/scrapy/conf/commands/crawl.py b/scrapy/conf/commands/crawl.py
deleted file mode 100644
index 357422ea3..000000000
--- a/scrapy/conf/commands/crawl.py
+++ /dev/null
@@ -1 +0,0 @@
-LOG_STDOUT = True
diff --git a/scrapy/log.py b/scrapy/log.py
index b086318e4..4e75854fa 100644
--- a/scrapy/log.py
+++ b/scrapy/log.py
@@ -5,7 +5,6 @@ See documentation in docs/topics/logging.rst
"""
import sys
from traceback import format_exc
-from contextlib import contextmanager
from twisted.python import log
from scrapy.xlib.pydispatch import dispatcher
@@ -73,13 +72,3 @@ def err(*args, **kwargs):
component = kwargs.pop('component', BOT_NAME)
kwargs['system'] = domain if domain else component
log.err(*args, **kwargs)
-
-_std_descriptors_backup = (sys.stdout, sys.stderr)
-
-@contextmanager
-def _std_descriptors():
- cur = (sys.stdout, sys.stderr)
- sys.stdout, sys.stderr = _std_descriptors_backup
- yield
- sys.stdout, sys.stderr = cur
-
diff --git a/scrapy/shell.py b/scrapy/shell.py
index 5f87747f9..df687a762 100644
--- a/scrapy/shell.py
+++ b/scrapy/shell.py
@@ -4,8 +4,6 @@ Scrapy Shell
See documentation in docs/topics/shell.rst
"""
-from __future__ import with_statement
-
import os
import urllib
import urlparse
@@ -22,7 +20,6 @@ from scrapy.core.manager import scrapymanager
from scrapy.core.engine import scrapyengine
from scrapy.http import Request
from scrapy.fetcher import get_or_create_spider
-from scrapy import log
def relevant_var(varname):
return varname not in ['shelp', 'fetch', 'view', '__builtins__', 'In', \
@@ -151,6 +148,4 @@ class Shell(object):
def inspect_response(response):
"""Open a shell to inspect the given response"""
- with log._std_descriptors():
- shell = Shell(nofetch=True)
- shell.inspect_response(response)
+ Shell(nofetch=True).inspect_response(response)
diff --git a/scrapy/utils/pdb.py b/scrapy/utils/pdb.py
deleted file mode 100644
index db924a2fb..000000000
--- a/scrapy/utils/pdb.py
+++ /dev/null
@@ -1,20 +0,0 @@
-"""
-Function for invoking the Python Debugger from Scrapy
-"""
-
-from __future__ import absolute_import, with_statement
-
-from pdb import Pdb
-
-from scrapy import log
-
-class ScrapyPdb(Pdb):
-
- def setup(self, f, t):
- Pdb.setup(self, f, t)
- self.curindex -= 2
-
-def set_trace():
- """Like pdb.set_trace() but works nice with the Scrapy log"""
- with log._std_descriptors():
- ScrapyPdb().set_trace()