Skip to content

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

Added needed conversion from unicode to string before using twisted's logging system because it may trigger encoding issues

elpolilla2cfd292f0159
diff --git a/scrapy/trunk/scrapy/log/__init__.py b/scrapy/trunk/scrapy/log/__init__.py
index ea3e1fcd6..bd0a17ee1 100644
--- a/scrapy/trunk/scrapy/log/__init__.py
+++ b/scrapy/trunk/scrapy/log/__init__.py
@@ -6,6 +6,7 @@ import sys
from twisted.python import log
from scrapy.conf import settings
+from scrapy.utils.python import unicode_to_str
# Logging levels
levels = {
@@ -48,7 +49,8 @@ def msg(message, level=INFO, component=BOT_NAME, domain=None):
""" Log message according to the level """
component = "%s/%s" % (BOT_NAME, domain) if domain else component
if level <= log_level:
- log.msg("%s: %s" % (levels[level], message), system=component)
+ msg_txt = unicode_to_str("%s: %s" % (levels[level], message))
+ log.msg(msg_txt, system=component)
def exc(message, level=ERROR, component=BOT_NAME, domain=None):
from traceback import format_exc