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

A

adrian

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?
 
P

Peter Otten

adrian said:
urllib.socket.setdefaulttimeout(self.timeout)
AttributeError: 'module' object has no attribute 'setdefaulttimeout'

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

Peter
 
I

infidel

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>
 
S

Steve Holden

Peter said:
adrian wrote:




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

Peter
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
 
J

John J. Lee

Steve Holden said:
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.

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


John
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top