AttributeError: 'module' object has no attribute 'setdefaulttimeout'

Discussion in 'Python' started by adrian, Mar 31, 2005.

  1. adrian

    adrian Guest

    I get those errors when I run:
    /usr/local/bin/SquidClamAV_Redirector.py -c
    /etc/squid/SquidClamAV_Redirector.conf

    ##################
    Traceback (most recent call last):
    File "/usr/local/bin/SquidClamAV_Redirector.py", line 573, in ?
    redirector = SquidClamAV_Redirector(config)
    File "/usr/local/bin/SquidClamAV_Redirector.py", line 145, in
    __init__
    self.__start_urlhandler__()
    File "/usr/local/bin/SquidClamAV_Redirector.py", line 454, in
    __start_urlhandler__
    urllib.socket.setdefaulttimeout(self.timeout)
    AttributeError: 'module' object has no attribute 'setdefaulttimeout'
    #################

    the line that is the problem looks like this:

    #############
    urllib.socket.setdefaulttimeout(self.timeout)
    #############

    from the global sintax:

    ##############
    def __start_urlhandler__(self):
    """ create the urlhandler object """
    # set timeout
    urllib.socket.setdefaulttimeout(self.timeout)
    self.urlhandler = urllib.URLopener()
    if self.proxy != {}:
    self.urlhandler.proxies = self.proxy
    self.urlhandler.addheaders = [('User-agent',
    ModuleName + ' ' + str(version))]

    ##############

    can you give me a hint with this matter?
     
    adrian, Mar 31, 2005
    #1
    1. Advertisements

  2. adrian

    Peter Otten Guest

    socket.setdefaulttimeout() was added in Python 2.3. You need to upgrade.

    Peter
     
    Peter Otten, Mar 31, 2005
    #2
    1. Advertisements

  3. adrian

    infidel Guest

    That just means the urllib.socket module doesn't have any function
    named setdefaulttimeout in it.

    It appears there might be something wrong with your socket module as
    mine has it:

    py> import urllib
    py> f = urllib.socket.setdefaulttimeout
    py> f
    <built-in function setdefaulttimeout>
     
    infidel, Mar 31, 2005
    #3
  4. adrian

    Steve Holden Guest

    Alternatively you might still be ablet o get Tom O'Malley's
    tiemoutsocket module, which I used in several applications until 2.3
    integrated the functionality.

    regards
    Steve
     
    Steve Holden, Mar 31, 2005
    #4
  5. adrian

    John J. Lee Guest

    I seem to recall a bug related to sendall(), though, IIRC. I reported
    it, but it didn't get fixed, again IIRC.


    John
     
    John J. Lee, Apr 1, 2005
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.