Bugs item #1682241, was opened at 2007-03-16 17:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682241&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Lucas Malor (lucas_malor)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problems with urllib2 read()

Initial Comment:
urllib2 objects opened with urlopen() does not have the method seek() as file 
objects. So reading only some bytes from opened urls is pratically forbidden.

An example: I tried to open an url and check if it's a gzip file. If IOError is 
raised I read the file (to do this I applied the #1675951 patch: 
https://sourceforge.net/tracker/index.php?func=detail&aid=1675951&group_id=5470&atid=305470
 )

But after I tried to open the file as gzip, if it's not a gzip file the current 
position in the urllib object is on the second byte. So read() returns the data 
from the 3rd to the last byte. You can't check the header of the file before 
storing it on hd. Well, so what is urlopen() for? If I must store the file by 
url on hd and reload it, I can use urlretrieve() ...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682241&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to