[issue10362] AttributeError: addinfourl instance has no attribute 'tell'

Senthil Kumaran report at bugs.python.org
Thu Nov 25 12:39:01 CET 2010

Senthil Kumaran <orsenthil at gmail.com> added the comment:

If you want to quickly solve this, do like this:

import urllib
import tarfile

tarfile.open(urllib.urlretrieve('http://plugins.supybot-fr.tk/GoodFrench.tar')[0], mode='r:') # Works

The problem is tarfile is expecting a "file-object" with a tell method for seeking, whereas urllib2 returns a file-like object, which does have a tell method. It seems to not have because, the underlying socket._fileobject is not exposing one (for whatever reason). Let me try to figure out reason for fixing/closing this bug.
(BTW, http module is relying on .tell() of the socket._fileobject too and I wonder it did not get noticed earlier because the has not taken that path yet? Strange!)

assignee:  -> orsenthil

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list