V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
bestehen
V2EX  ›  Python

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

  •  
  •   bestehen · 2018-07-25 16:43:51 +08:00 · 1654 次点击
    这是一个创建于 2100 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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
    2 条回复    2018-07-27 09:12:27 +08:00
    julyclyde
        1
    julyclyde  
       2018-07-26 10:44:32 +08:00
    你先把 cmd 输出看看
    KeatingSmith
        2
    KeatingSmith  
       2018-07-27 09:12:27 +08:00
    用 sudo 的话,是不是需要输入密码才得行哦?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1086 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 95ms · UTC 22:40 · PVG 06:40 · LAX 15:40 · JFK 18:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.