urllib2 FTP Weirdness
steve+comp.lang.python at pearwood.info
Thu Jan 24 01:41:44 CET 2013
Nick Cash wrote:
> Python 2.7.3 on linux
> This has me fairly stumped. It looks like
> will either immediately return '' or hang indefinitely. But
> response = urllib2.urlopen("ftp://some.ftp.site/path")
> works fine and returns what is expected. This is only an issue with
> urllib2, vanilla urllib doesn't do it.
> The site I first noticed it on is private, but I can reproduce it with
Then why not give that in your example, to make running your code
I cannot reproduce the problem:
py> import urllib2
py> x = urllib2.urlopen("ftp://ftp2.census.gov/").read()
Works fine for me using Python 2.7.2 on Linux. I cannot see how the two
snippets you give could possibly be different. If you are using a proxy,
what happens if you bypass it?
If you can reproduce this at will, with and without proxy, with multiple
sites, then I suppose it is conceivable that it could be some sort of bug.
But I wouldn't bet on it.
More information about the Python-list