urllib2 bug?

B

bob sacamano

Certain pages cause urllib2 to go into an infinite loop when using
readline(), but everything works fine if read() is used instead. Is
this a bug or am I missing something simple?

import urllib2

url = 'http://www.naylamp.com'

f = urllib2.urlopen(url)

i = 0

#this works fine when uncommented
#print f.read()
#print 'finished'

#this never ends
while 1:
line = f.readline()
if not line:
break
print line
print i
i = i + 1
#end while
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top