0

I want to pass some data using Python RPC. I got the result correctly but also got an error.

xmlrpclib.Fault: :invalid literal for float(): 127.0.0.1">.

I did not change anything just got the error suddenly. It looks like the parameter issue when I trying pass the data using PRC api. But I still did not get it.

enter image description here

def election_stop():
    time.sleep(5)
    while 1:
        global candidate_ids,candidate_adds,candidate_ports,lessthan
        if take_over==True and lessthan<=devices_attached:
        index_=candidate_ids.index(max(candidate_ids))
        add_s=candidate_adds[index_]
        port_s=candidate_ports[index_]
        print candidate_adds
        print "[Gateway]"+str(add_s)+str(port_s)+"win"
    try:
        proxy = xmlrpclib.ServerProxy("http://"+add_s+":"+str(port_s)+"/")
        ret = proxy.elec_recv("WIN",str(port_s),str(add_s),"you win pls takeover")
        #ret = proxy.elec_recv("LEADER",candidate_ports[0:lessthan],candidate_adds[0:lessthan],candidate_ids[0:lessthan])
        ret = proxy.elec_recv("LEADER",candidate_ports[0:lessthan],candidate_adds[0:lessthan],candidate_ids[0:lessthan])
        break
    except socket_error,exceptions.ValueError:
        print socket_error
        continue
    return "stop"
Traceback (most recent call last):
  File "./gateway.py", line 341, in <module>
    election_stop()
  File "./gateway.py", line 155, in election_stop
    ret = proxy.elec_recv("LEADER",candidate_ports[0:lessthan],candidate_adds[0:lessthan],candidate_ids[0:lessthan])
  File     "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1578, in __request
    verbose=self.__verbose
   File       "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1264, in request
     return self.single_request(host, handler, request_body, verbose)
   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1297, in single_request
     return self.parse_response(response)
   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1473, in parse_response
     return u.close()
   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 793, in close
     raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<type 'exceptions.ValueError'>:invalid literal for float(): 127.0.0.1">
Mike Laren
  • 8,028
  • 17
  • 51
  • 70
user2263305
  • 97
  • 1
  • 2
  • 7

1 Answers1

0

You're passing the argument "127.0.0.1" to a function on the server that is expecting an argument of type float.

101
  • 8,514
  • 6
  • 43
  • 69