FAQ
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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJul 29, '05 at 11:03p
activeJul 29, '05 at 11:03p
posts1
users1
websitepython.org

1 user in discussion

Bob sacamano: 1 post

People

Translate

site design / logo © 2019 Grokbase