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
After upgrading logging, this error no longer appears.