簡體   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