cerremony
cerremony

Reputation: 223

Fault: No Attribute in xmlrpclib.py

I'm working on an application in which a server and client are being created; the ServerAPI is using SimpleXMLRPCServer and the ClientAPI is using xmlrpclib. The client is initiated with:

class w_Client:
        def __init__(self, ServerIP, ServerPort, ClientIP):
                self.conn = xmlrpclib.ServerProxy("http://" + ServerIP + ":" + str(ServerPort))
                self.ClientIP = ClientIP

upon a button being pressed in the application, an xml specification file is created and passed thru

        def Create(self, XMLstring):
            return self.conn.Create(XMLstring, self.ClientIP)

I've already checked to make sure that the XMLstring is valid XML; however, when I get press the button, I get the following error:

Traceback (most recent call last):

  File "/home/app/UI/MainWindow.py", line 461, in compile
    xmlFile = compiler.compile()
  File "/home/app/Core/Compiler.py", line 75, in compile
    self.compile_top()
  File "/home/app/Core/Compiler.py", line 354, in compile_top
    status = mainWidgets["w_client"].Create(xmlString)
  File "/home/app/Wireless/ClientAPI.py", line 12, in Create
    return self.conn.Create(XMLstring, self.ClientIP)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1591, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1306, in single_request
    return self.parse_response(response)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1482, in parse_response
    return u.close()
  File "/usr/lib/python2.7/xmlrpclib.py", line 794, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<type 'exceptions.TypeError'>:'NoneType' object has no attribute '__getitem__'">

I've also made sure that the ClientIP is passed correctly. Otherwise, I'm not entirely sure what's going on or how to even go about fixing it.

Upvotes: 0

Views: 1888

Answers (1)

MattH
MattH

Reputation: 38265

<type 'exceptions.TypeError'>:'NoneType' object has no attribute '__getitem__'

This exception may have been generated by the xmlrpc method you were calling (i.e. server side).

I suggest that you add verbose=True to your instantiation of the server proxy:

xmlrpclib.ServerProxy("http://" + ServerIP + ":" + str(ServerPort),verbose=True)

This will allow you to see what you're sending and receiving.

It seems the method you're calling is expecting a dict

Upvotes: 1

Related Questions