Python引入 requests 会报UnicodeDecodeError
D:\codeSoft\Python2\python.exe "D:\program files (x86)\JetBrains\PyCharm Community Edition 2016.3.2\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 5504 --file E:/anCode/pycharm/rexx/lesson3/xpathTest3_thread.py
pydev debugger: process 13136 is connecting
Connected to pydev debugger (build 163.10154.50)
Traceback (most recent call last):
File "D:\program files (x86)\JetBrains\PyCharm Community Edition 2016.3.2\helpers\pydev\pydevd.py", line 1596, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\program files (x86)\JetBrains\PyCharm Community Edition 2016.3.2\helpers\pydev\pydevd.py", line 974, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "E:/anCode/pycharm/rexx/lesson3/xpathTest3_thread.py", line 4, in <module>
import requests
File "D:\codeSoft\Python2\lib\site-packages\requests\__init__.py", line 52, in <module>
from .packages.urllib3.contrib import pyopenssl
File "D:\codeSoft\Python2\lib\site-packages\requests\packages\urllib3\contrib\pyopenssl.py", line 47, in <module>
from cryptography import x509
File "D:\codeSoft\Python2\lib\site-packages\cryptography\x509\__init__.py", line 7, in <module>
from cryptography.x509.base import (
File "D:\codeSoft\Python2\lib\site-packages\cryptography\x509\base.py", line 16, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "D:\codeSoft\Python2\lib\site-packages\cryptography\x509\extensions.py", line 14, in <module>
from asn1crypto.keys import PublicKeyInfo
File "D:\codeSoft\Python2\lib\site-packages\asn1crypto\keys.py", line 22, in <module>
from ._elliptic_curve import (
File "D:\codeSoft\Python2\lib\site-packages\asn1crypto\_elliptic_curve.py", line 51, in <module>
from ._int import inverse_mod
File "D:\codeSoft\Python2\lib\site-packages\asn1crypto\_int.py", line 56, in <module>
from ._perf._big_num_ctypes import libcrypto
File "D:\codeSoft\Python2\lib\site-packages\asn1crypto\_perf\_big_num_ctypes.py", line 31, in <module>
libcrypto_path = find_library('crypto')
File "D:\codeSoft\Python2\lib\ctypes\util.py", line 53, in find_library
fname = os.path.join(directory, name)
File "D:\codeSoft\Python2\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 7: ordinal not in range(128)
Process finished with exit code 1
相关推荐
python3的UnicodeDecodeError解决方法
爬虫部分解码异常 response.content.decode() # 默认使用 utf-8 出现解码异常 以下是设计的通用解码 通过 text 获取编码 # 通过 text 获取编码 import requests from lxml import etree def public_decode(): headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Sa
Python响应对象text属性乱码解决方案
主要介绍了Python响应对象text属性乱码解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
python爬虫常见异常共1页.pdf.zip
python爬虫常见异常共1页.pdf.zip
python文件读取失败怎么处理
在本篇文章里小编给大家分享的是关于python文件读取失败怎么处理的相关文章,需要的朋友们参考下。
彻底解决Python文件读取中的UnicodeDecodeError:从编码原理到实战方案
字符编码是计算机处理文本的基础,它定义了字符与字节序列之间的映射规则。不同编码标准(如UTF-8、GBK)的差异,是导致文件读取时出现解码错误的根本原因。理解编码原理对于确保数据交换的准确性和程序的健壮性至关重要。在工程实践中,尤其是在处理多来源文本数据时,编码不匹配会引发UnicodeDecodeError等常见问题,影响数据处理流程。本文聚焦于Python中经典的'gbk' codec can't decode错误,通过剖析编码机制,提供从诊断、探测到解决的完整方案,涵盖使用chardet库、指定enc


