win7下调试scrapy代码时,出现代码报错,但是未输出到log日志,而是在cmd中报如下错误:
Traceback (most recent call last):
File "d:\python27\lib\logging\__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
各种尝试均告失败,后来在论坛中发现有人说这个bug在python3环境不存在,于是尝试升级python2.7的logging组件。
Shell代码
pip install --upgrade logging
升级logging后再无此报错出现。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号