【问题标题】:urlopen windows ftp errorurlopen windows ftp错误
【发布时间】:2011-09-09 21:36:43
【问题描述】:

此代码在 linux 上运行良好,但在 windows 上存在错误。怎么了?

import urllib, urllib2

a = 'ftp://ftp.arin.net/pub/stats/arin/delegated-arin-latest'

urllib.urlopen(a)
IOError: [Errno ftp error] proxy support for ftp protocol currently not implemented

urllib2.urlopen(a)
URLError: <urlopen error ftp error: >

【问题讨论】:

  • 你确定 a 是一个字符串吗?根据codespeak.net/svn/pypy/dist/lib-python/2.5.2/urllib.py,如果 a 不是字符串,则会引发此错误...
  • 输入 [8]: type(a) Out[8]:
  • 我建议在提供的 url 跟踪代码...
  • 怎么样?在 linux 我没有这个问题。也许是 Windows 插座或类似的东西?
  • 将您的代码放在文件“error.py”中,并使用带有“python -m pdb error.py”的python调试器并逐步执行代码。这就是我会做的。

标签: python urllib2 urllib


【解决方案1】:

检查您的 Internet Explorer 中是否有一些代理设置:菜单 Extras->Internet 选项,有 Connections->“LAN 设置”(或类似的东西)。如果您有代理服务器设置,则 urllib 将不起作用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-12
    • 2011-05-13
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多