Home > Backend Development > Python Tutorial > Solution to scrapy output error log in win7 environment

Solution to scrapy output error log in win7 environment

巴扎黑
Release: 2016-12-07 09:22:48
Original
2911 people have browsed it

When debugging scrapy code under win7, a code error occurs, but it is not output to the log. Instead, the following error is reported in cmd:

Traceback (most recent call last):
File "d:python27liblogging__init__.py", line 884 , in emit
stream.write(fs % msg.encode("UTF-8"))
UnicodeDecodeError: 'gbk' codec can't decode bytes in position 1274-1275: illegal multibyte sequence
Logged from file scraper.py, line 158

Various attempts failed. Later, I found someone in the forum saying that this bug did not exist in the python3 environment, so I tried to upgrade the logging component of python2.7.

Shell code

pip install --upgrade logging
Copy after login

After upgrading logging, this error no longer appears.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
python scrapy crawler error
From 1970-01-01 08:00:00
0
0
0
How to convert response into object in scrapy?
From 1970-01-01 08:00:00
0
0
0
Scrapy how to get original start_url
From 1970-01-01 08:00:00
0
0
0
Python failed to install scrapy
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template