urllib2 bug?

Discussion in 'Python' started by bob sacamano, Jul 30, 2005.

  1. bob sacamano

    bob sacamano Guest

    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
     
    bob sacamano, Jul 30, 2005
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    Re: BUG? OR NOT A BUG?

    John, Sep 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    772
  2. RedEye
    Replies:
    2
    Views:
    741
    Jason Kester
    Dec 13, 2005
  3. Michel Joly de Lotbiniere

    Bug Parade Bug 4953793

    Michel Joly de Lotbiniere, Nov 30, 2003, in forum: Java
    Replies:
    4
    Views:
    841
    Michel
    Dec 2, 2003
  4. DarkSpy
    Replies:
    4
    Views:
    1,070
    tom_usenet
    Jun 27, 2003
  5. Steve Holden
    Replies:
    1
    Views:
    574
    Behrang Dadsetan
    Jul 2, 2003
  6. Chris Green
    Replies:
    2
    Views:
    495
    Michael Schutte
    Dec 18, 2003
  7. Replies:
    1
    Views:
    552
    Fuzzyman
    Jul 27, 2005
  8. Josef Cihal
    Replies:
    0
    Views:
    1,251
    Josef Cihal
    Sep 5, 2005
Loading...