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

Solution to scrapy output error log in win7 environment

Dec 07, 2016 am 09:22 AM
scrapy

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.


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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Scrapy implements crawling and analysis of WeChat public account articles Scrapy implements crawling and analysis of WeChat public account articles Jun 22, 2023 am 09:41 AM

Scrapy implements crawling and analysis of WeChat public account articles

Scrapy case analysis: How to crawl company information on LinkedIn Scrapy case analysis: How to crawl company information on LinkedIn Jun 23, 2023 am 10:04 AM

Scrapy case analysis: How to crawl company information on LinkedIn

Scrapy asynchronous loading implementation method based on Ajax Scrapy asynchronous loading implementation method based on Ajax Jun 22, 2023 pm 11:09 PM

Scrapy asynchronous loading implementation method based on Ajax

Scrapy optimization tips: How to reduce crawling of duplicate URLs and improve efficiency Scrapy optimization tips: How to reduce crawling of duplicate URLs and improve efficiency Jun 22, 2023 pm 01:57 PM

Scrapy optimization tips: How to reduce crawling of duplicate URLs and improve efficiency

Scrapy crawler practice: crawling QQ space data for social network analysis Scrapy crawler practice: crawling QQ space data for social network analysis Jun 22, 2023 pm 02:37 PM

Scrapy crawler practice: crawling QQ space data for social network analysis

In-depth use of Scrapy: How to crawl HTML, XML, and JSON data? In-depth use of Scrapy: How to crawl HTML, XML, and JSON data? Jun 22, 2023 pm 05:58 PM

In-depth use of Scrapy: How to crawl HTML, XML, and JSON data?

How does Scrapy implement Docker containerization and deployment? How does Scrapy implement Docker containerization and deployment? Jun 23, 2023 am 10:39 AM

How does Scrapy implement Docker containerization and deployment?

How Scrapy improves crawling stability and crawling efficiency How Scrapy improves crawling stability and crawling efficiency Jun 23, 2023 am 08:38 AM

How Scrapy improves crawling stability and crawling efficiency

See all articles