Python 调用 wget 命令下载报错如下

2018-07-25 16:43:51 +08:00
 bestehen
save_path = os.path.join("/home/shenjianlin/pdf_file",name)
try:
cmd = ("sudo wget -P -N -o -c -O {} {}".format(save_path, link))
ref = subprocess.call(cmd, shell=True)
if ref != 0:
print ("can't get download")
else:
print("finishing downloading {} page {} row data".format(i,j))
except Exception as e :
print('download error has happend')
print (e)

报错如下:
/bin/sh: $'\350\266\213\345\212\277\345\261\225\346\234\233-82\351\241\265': command not found
can't get download
《 2018 暑期旅游消费趋势预测》:亲子客群占主流  高档海岛酒店占比提升-6 页.pdf
途牛旅游网
2018-06-22 18:01:38
http://pdf1.qimingpian.com/announcement_real/5b2c9ac2320c7.pdf


wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
can't get download
1658 次点击
所在节点    Python
2 条回复
julyclyde
2018-07-26 10:44:32 +08:00
你先把 cmd 输出看看
KeatingSmith
2018-07-27 09:12:27 +08:00
用 sudo 的话,是不是需要输入密码才得行哦?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/474097

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX