推荐学习书目
› 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
lixuda
V2EX  ›  Python

Python ftp 上传 阿里云服务器问题

  •  
  •   lixuda · Oct 17, 2017 · 3425 views
    This topic created in 3265 days ago, the information mentioned may be changed or developed.

    用 python ftplib 上传文件。本地运行程序一直正常。

    然后把代码放到阿里云运行,出现错误,应该是上传的时候返回的 ip 变成阿里云内网的 ip 地址,这个怎么解决?

    提示错误: ftplib.error_perm: 500 I won't open a connection to 阿里云内网 ip (only to 阿里云外网 ip)

    2 replies  •  2017-10-20 14:17:10 +08:00
    dayinfinte
        1
    dayinfinte  
       Oct 18, 2017
    这个应该是跟 ftp 原理有关,并且你如果只是一个虚拟机,就没有公网 IP 的话,就不行,或者申请阿里云独享 IP 的服务,应该就可以了
    lixuda
        2
    lixuda  
    OP
       Oct 20, 2017
    @dayinfinte 解决了,不是虚拟机。ftplib 库会获取本机 ip 地址,然后获取的是内网的 ip,所以错误。我修改了库,指定外网 ip 就可以了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2299 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:52 · PVG 08:52 · LAX 17:52 · JFK 20:52
    ♥ Do have faith in what you're doing.