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

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to