【发布时间】: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调试器并逐步执行代码。这就是我会做的。