NameError: name 'ProxyError' is not defined 问题的处理方法

在使用python进行数据采集的时候需要使用代理。代理有周期,一旦过期后,就会产生异常。异常报错会以ProxyError作为开头。
但是当你用ProxyError作为异常的标题的时候会出现NameError: name 'ProxyError' is not defined的提示。
解决方法是将其改为 ConnectionError。实际上并没有ProxyError这个错误!!
参考:参考

$ python Python 3.12.9 (main, Feb 4 2025, 22:30:28) [Clang 18.0.3 (https://android.googlesource.com/toolchain/llvm-project d8003a456 on linux Type "help", "copyright", "credits" or "license" for more information. >>> import akshare as ak Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/akshare/__init__.py", line 4642, in <module> from akshare.stock_feature.stock_a_pe_and_pb import ( File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/akshare/stock_feature/stock_a_pe_and_pb.py", line 320, in <module> js_functions = py_mini_racer.MiniRacer() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/py_mini_racer/py_mini_racer.py", line 178, in __init__ self.__class__.ext = _build_ext_handle() ^^^^^^^^^^^^^^^^^^^ File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/py_mini_racer/py_mini_racer.py", line 125, in _build_ext_handle raise RuntimeError("Native library not available at {}".format(EXTENSION_PATH)) RuntimeError: Native library not available at /data/data/com.termux/files/usr/lib/python3.12/site-packages/py_mini_racer/libmini_racer.glibc.so >>> print(ak.__version__) Exception ignored in: <function MiniRacer.__del__ at 0x775999a520> Traceback (most recent call last): File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/py_mini_racer/py_mini_racer.py", line 315, in __del__ self.ext.mr_free_context(getattr(self, "ctx", None)) ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'mr_free_context' Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'ak' is not defined
最新发布
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值