python urlretrieve 失败_urllib.request.urlretrieve下载错误

本文记录了一次使用PyCharm进行Python项目开发时遇到的HTTP 461错误,并详细展示了从错误发生到定位问题根源的过程。通过对错误堆栈的解析,本文旨在帮助开发者理解该错误产生的原因及可能的解决方案。
摘要由CSDN通过智能技术生成

Traceback (most recent call last):

File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1531, in <module>

globals = debugger.run(setup['file'], None, None, is_module)

File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 938, in run

pydev_imports.execfile(file, globals, locals)  # execute the script

File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile

exec(compile(contents+"\n", file, 'exec'), glob, loc)

File "/Users/wz/PycharmProjects/装备/main.py", line 204, in <module>

three_hundred_hero.get_png(data)

File "/Users/wz/PycharmProjects/装备/main.py", line 45, in get_png

urllib.request.urlretrieve(item['url'], str(file_name))

File "/Users/wz/anaconda/lib/python3.5/urllib/request.py", line 188, in urlretrieve

with contextlib.closing(urlopen(url, data)) as fp:

File "/Users/wz/anaconda/lib/python3.5/urllib/request.py", line 163, in urlopen

return opener.open(url, data, timeout)

File "/Users/wz/anaconda/lib/python3.5/urllib/request.py", line 472, in open

response = meth(req, response)

File "/Users/wz/anaconda/lib/python3.5/urllib/request.py", line 582, in http_response

'http', request, response, code, msg, hdrs)

File "/Users/wz/anaconda/lib/python3.5/urllib/request.py", line 510, in error

return self._call_chain(*args)

File "/Users/wz/anaconda/lib/python3.5/urllib/request.py", line 444, in _call_chain

result = func(*args)

File "/Users/wz/anaconda/lib/python3.5/urllib/request.py", line 590, in http_error_default

raise HTTPError(req.full_url, code, msg, hdrs, fp)

urllib.error.HTTPError: HTTP Error 461:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值