繁体   English   中英

Python: urllib.error.URLError:<urlopen error [WinError 3] The system cannot find the path specified: ' '>

[英]Python: urllib.error.URLError: <urlopen error [WinError 3] The system cannot find the path specified: ' '>

对此很陌生,所以我不确定为什么会收到此错误

相关代码:

htmlconv = open('savedlist.html','w', encoding = 'UTF-8')
filepath = 'file://'+str(path.abspath('savedlist.html'))
#prints as: file://C:\Users\....\savedlist.html

urlopen(filepath)

错误:

urllib.error.URLError: <urlopen error [WinError 3] The system cannot find the path specified:''>

提前致谢!

尝试以下面的格式手动输入字符串,看看是否有效。

filepath = 'file:///C:\\Users\\....\\savedlist.html'

添加'localhost//',它对我有用。

filepath = 'file://localhost//' + os.path.abspath(local_file);

urllib.error.URLError:

[英]urllib.error.URLError: <urlopen error [WinError 10060] using urllib.request.urlretrieve() on Windows 10 with Python3

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM