urllib2 FTP Weirdness

Chris Angelico rosuav at gmail.com
Thu Jan 24 00:58:04 CET 2013

On Thu, Jan 24, 2013 at 7:07 AM, Nick Cash
<nick.cash at npcinternational.com> wrote:
> Python 2.7.3 on linux
> This has me fairly stumped. It looks like
>         urllib2.urlopen("ftp://some.ftp.site/path").read()
> will either immediately return '' or hang indefinitely. But
>         response = urllib2.urlopen("ftp://some.ftp.site/path")
>         response.read()
> 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 "ftp://ftp2.census.gov/".

Confirmed on 2.6.5 on Windows, fwiw. This is extremely weird. Possibly
it's some kind of race condition??


More information about the Python-list mailing list