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
2869 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template