使用Jython的Kazoo包

时间:2017-04-24 21:01:15

标签: jython apache-zookeeper kazoo

Kazoo在Python下工作得很好,但我正在研究的项目需要在Jython下使用它。

问题在于:

>>> from kazoo.client import KazooClient
>>> zk = KazooClient('127.0.0.1')
>>> zk.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\jython2.7.0\Lib\site-packages\kazoo\client.py", line 541, in start
    event = self.start_async()
  File "C:\jython2.7.0\Lib\site-packages\kazoo\client.py", line 576, in start_async
    self._connection.start()
  File "C:\jython2.7.0\Lib\site-packages\kazoo\protocol\connection.py", line 170, in start
    rw_sockets = self.handler.create_socket_pair()
  File "C:\jython2.7.0\Lib\site-packages\kazoo\handlers\threading.py", line 165, in create_socket_pair
    return utils.create_socket_pair(socket)
  File "C:\jython2.7.0\Lib\site-packages\kazoo\handlers\utils.py", line 148, in create_socket_pair
    temp_srv_sock.bind(('', port))
  File "C:\jython2.7.0\Lib\_socket.py", line 1367, in meth
    return getattr(self._sock,name)(*args)
  File "C:\jython2.7.0\Lib\_socket.py", line 812, in bind
    self.bind_addr = _get_jsockaddr(address, self.family, self.type, self.proto, AI_PASSIVE)
  File "C:\jython2.7.0\Lib\_socket.py", line 1565, in _get_jsockaddr
    addr = _get_jsockaddr2(address_object, family, sock_type, proto, flags)
  File "C:\jython2.7.0\Lib\_socket.py", line 1594, in _get_jsockaddr2
    hostname = {AF_INET: INADDR_ANY, AF_INET6: IN6ADDR_ANY_INIT}[family]
KeyError: 0

我怎么说 - 使用python没有这种问题。 我很确定它与_socket.py文件的Jython版本有关,但不知道解决方法。

你能推荐什么?

0 个答案:

没有答案