[New-bugs-announce] [issue15002] urllib2 does not download 4 MB file fully using ftp

sspapilin report at bugs.python.org
Mon Jun 4 22:14:41 CEST 2012

New submission from sspapilin <sspapilin at gmail.com>:

File test.py is

#!/usr/bin/env python
import urllib2
print urllib2.urlopen('ftp://ftp.ripe.net/pub/stats/ripencc/delegated-ripencc-extended-latest').read()

When I issue

python test.py > out.txt

, I get file about 100KB in size, the beginning of the actual file. I repeated it a hundred times, and almost every time I get 98305 byte file, and a couple of times a 49153 bytes or 188417 bytes file.

When I replace urllib2 with urllib in test.py, I get full (4 MB) file.

I have Ubuntu 12.04 64-bit, Python 2.7.3 (from default Ubuntu repository, up-to-date as of 4-june-2012) and slow, 64KB/s, Internet connection.

However, I asked my friend with Windows and faster connection to check it, and he got partial download as well, while he had another size of partial file (50109 bytes). I do not know his OS ant Python versions.

components: Library (Lib)
files: test.py
messages: 162287
nosy: sspapilin
priority: normal
severity: normal
status: open
title: urllib2 does not download 4 MB file fully using ftp
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file25821/test.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list