xmlrpc: hostname nor servname provided ?

Laszlo Nagy gandalf at designaproduct.biz
Tue Jul 25 16:48:18 EDT 2006


I'm running a service on a machine. The service is written in Python (of 
course) and it connects to an XMLRPC server periodically.
It recreates the ServerProxy instance each time it needs to connect to 
the RPC server.

The server is created with this code:

server = xmlrpclib.ServerProxy(local.SERVER_URL,allow_none=True)   # 
local.SERVER_URL is something like 'https://myserver.com:3421'


After running for a few hours, I always get this:

2006-07-25 16:33:26,431 ERROR .main Traceback (most recent call last):
  File "/home/gandalf/AmazonOfferDownloader/AmazonOfferDownloader.py", 
line 27, in run
    logger.info("Connected to %s",server.serversignature())
  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')

This exception does not stop my server program and it keeps trying to 
connect to the xmlrpc server, but it raises the same exception again and 
again.
However, if I restart the program then everything works. The XML RPC 
server has a static IP address and it is never restarted/reconfigured.
I cannot find the problem. Please help me.


   Laszlo





More information about the Python-list mailing list