Skip to content

Commit 272085b

Browse files
committed
Make sure RetryMiddleware logs ASCII-only exception strings in Python 2. Fixes scrapyGH-1330.
1 parent 6fa3f24 commit 272085b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scrapy/downloadermiddlewares/retry.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ def process_response(self, request, response, spider):
6060
return response
6161

6262
def process_exception(self, request, exception, spider):
63-
if isinstance(exception, self.EXCEPTIONS_TO_RETRY) \
64-
and not request.meta.get('dont_retry', False):
65-
return self._retry(request, exception, spider)
63+
if not isinstance(exception, self.EXCEPTIONS_TO_RETRY):
64+
return
65+
if request.meta.get('dont_retry', False):
66+
return
67+
return self._retry(request, repr(exception), spider)
6668

6769
def _retry(self, request, reason, spider):
6870
retries = request.meta.get('retry_times', 0) + 1

0 commit comments

Comments
 (0)