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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • adrian

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

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

    ############### ###
    Traceback (most recent call last):
    File "/usr/local/bin/SquidClamAV_Red irector.py", line 573, in ?
    redirector = SquidClamAV_Red irector(config)
    File "/usr/local/bin/SquidClamAV_Red irector.py", line 145, in
    __init__
    self.__start_ur lhandler__()
    File "/usr/local/bin/SquidClamAV_Red irector.py", line 454, in
    __start_urlhand ler__
    urllib.socket.s etdefaulttimeou t(self.timeout)
    AttributeError: 'module' object has no attribute 'setdefaulttime out'
    ############### ##

    the line that is the problem looks like this:

    #############
    urllib.socket.s etdefaulttimeou t(self.timeout)
    #############

    from the global sintax:

    ##############
    def __start_urlhand ler__(self):
    """ create the urlhandler object """
    # set timeout
    urllib.socket.s etdefaulttimeou t(self.timeout)
    self.urlhandler = urllib.URLopene r()
    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?

  • Peter Otten

    #2
    Re: AttributeError: 'module' object has no attribute 'setdefaulttime out'

    adrian wrote:
    [color=blue]
    > urllib.socket.s etdefaulttimeou t(self.timeout)
    > AttributeError: 'module' object has no attribute 'setdefaulttime out'[/color]

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

    Peter


    Comment

    • infidel

      #3
      Re: AttributeError: 'module' object has no attribute 'setdefaulttime out'

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

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

      py> import urllib
      py> f = urllib.socket.s etdefaulttimeou t
      py> f
      <built-in function setdefaulttimeo ut>

      Comment

      • Steve Holden

        #4
        Re: AttributeError: 'module' object has no attribute'setde faulttimeout'

        Peter Otten wrote:[color=blue]
        > adrian wrote:
        >
        >[color=green]
        >>urllib.socket .setdefaulttime out(self.timeou t)
        >>AttributeErro r: 'module' object has no attribute 'setdefaulttime out'[/color]
        >
        >
        > socket.setdefau lttimeout() was added in Python 2.3. You need to upgrade.
        >
        > Peter
        >
        >[/color]
        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 +1 703 861 4237 +1 800 494 3119
        Holden Web LLC http://www.holdenweb.com/
        Python Web Programming http://pydish.holdenweb.com/

        Comment

        • John J. Lee

          #5
          Re: AttributeError: 'module' object has no attribute 'setdefaulttime out'

          Steve Holden <steve@holdenwe b.com> writes:
          [color=blue]
          > Peter Otten wrote:[color=green]
          > > adrian wrote:
          > >[color=darkred]
          > >>urllib.socket .setdefaulttime out(self.timeou t)
          > >>AttributeErro r: 'module' object has no attribute 'setdefaulttime out'[/color]
          > > socket.setdefau lttimeout() was added in Python 2.3. You need to
          > > upgrade.
          > > Peter
          > >[/color]
          > 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.[/color]

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


          John

          Comment

          Working...