gaierror: (8, 'hostname nor servname provided, or not known')

faulkner faulkner612 at comcast.net
Mon Jul 31 14:10:36 EDT 2006


my boss has a similar problem with his home internet connection in
general. he traced it back to his router, which was in the first couple
generations of routers. how old are the routers you tested this on?
aside from upgrading them, if they are the problem, i can suggest a
workaround.
the first time this exception is raised, your script can automatically
restart itself.
os.system('python -c "import time, os; time.sleep(2);
os.system(\'python yourscriptname.py &\')" &')
sys.exit(1)


Laszlo Nagy wrote:
> Hello,
>
> I asked this question about a week ago, but I did not provide a
> traceback. Here is the traceback:
>
>   File "/usr/local/lib/python2.4/xmlrpclib.py", line 1096, in __call__
>     return self.__send(self.__name, args)
>   File "/usr/local/lib/python2.4/xmlrpclib.py", line 1383, in __request
>     verbose=self.__verbose
>   File "/usr/local/lib/python2.4/xmlrpclib.py", line 1129, in request
>     self.send_content(h, request_body)
>   File "/usr/local/lib/python2.4/xmlrpclib.py", line 1243, in send_content
>     connection.endheaders()
>   File "/usr/local/lib/python2.4/httplib.py", line 798, in endheaders
>     self._send_output()
>   File "/usr/local/lib/python2.4/httplib.py", line 679, in _send_output
>     self.send(msg)
>   File "/usr/local/lib/python2.4/httplib.py", line 646, in send
>     self.connect()
>   File "/usr/local/lib/python2.4/httplib.py", line 1072, in connect
>     sock.connect((self.host, self.port))
>   File "<string>", line 1, in connect
> gaierror: (8, 'hostname nor servname provided, or not known')
>
> The program is connecting to the same host about 2 times per minute.
> After running for one or two hours, it raises this exception. Once it
> raised this exception, it keeps raising in. (My program is trying to
> connect but it cannot.) Then I restart my program and it works for
> anoter hour or two. I tried the same program on different machines and
> different operating system, but the error is always the same. Please
> help me identify the problem.
> 
> Thanks,
> 
>    Laszlo




More information about the Python-list mailing list