urllib2 gets 404 error cannot display after a while

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leo1980
    New Member
    • Feb 2009
    • 1

    #1

    urllib2 gets 404 error cannot display after a while

    i use urllib2 to open the websites and get info. it works for a while, then will be stopped, the error in idle is http error 404 no such domain. but i just changed the parameters in the url by looping, and i can open it in ie or firefox. any one have any idea to deal with it? if I running 2 more similar programs in command line at same time, them will be stopped more sooner.

    my code is running in python 2.5 + tor.

    Thks a lot.


    "Traceback (most recent call last):
    File "C:\Documen ts and Settings\XXXX\D esktop\NZ_New - Copy\NZ 1- 40 14022009\nz_new 1.py", line 191, in <module>
    Main()
    File "C:\Documen ts and Settings\XXXX\D esktop\NZ_New - Copy\NZ 1- 40 14022009\nz_new 1.py", line 69, in Main
    Process(1)
    File "C:\Documen ts and Settings\XXXX\D esktop\NZ_New - Copy\NZ 1- 40 14022009\nz_new 1.py", line 141, in Process
    input_page = urllib2.urlopen (req)
    File "C:\Python25\li b\urllib2.py", line 121, in urlopen
    return _opener.open(ur l, data)
    File "C:\Python25\li b\urllib2.py", line 380, in open
    response = meth(req, response)
    File "C:\Python25\li b\urllib2.py", line 491, in http_response
    'http', request, response, code, msg, hdrs)
    File "C:\Python25\li b\urllib2.py", line 418, in error
    return self._call_chai n(*args)
    File "C:\Python25\li b\urllib2.py", line 353, in _call_chain
    result = func(*args)
    File "C:\Python25\li b\urllib2.py", line 499, in http_error_defa ult
    raise HTTPError(req.g et_full_url(), code, msg, hdrs, fp)
    HTTPError: HTTP Error 404: No such domain"
  • sharat87
    New Member
    • Feb 2009
    • 6

    #2
    hey,
    could you put the code of the loop you are talking about... and also give some code around the lines 191, 69 and 141

    I'll try to help :)

    regards,
    sharat87

    Comment

    Working...