卡桑德拉连接问题

Cassandra connection issue

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/local/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
  File "cassandra/connection.py", line 895, in cassandra.connection.Connection.__str__
TypeError: %d format: a number is required, not str
Call stack:
  File "/usr/local/lib/python3.6/threading.py", line 884, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/site-packages/cassandra/io/asyncorereactor.py", line 258, in _run_loop
    self._loop_dispatcher.loop(self.timer_resolution)
  File "/usr/local/lib/python3.6/site-packages/cassandra/io/asyncorereactor.py", line 119, in loop
    asyncore.loop(timeout=timeout, use_poll=True, map=_dispatcher_map, count=1)
  File "/usr/local/lib/python3.6/asyncore.py", line 207, in loop
    poll_fun(timeout, map)
  File "/usr/local/lib/python3.6/asyncore.py", line 188, in poll2
    readwrite(obj, flags)
  File "/usr/local/lib/python3.6/asyncore.py", line 108, in readwrite
    obj.handle_read_event()
  File "/usr/local/lib/python3.6/asyncore.py", line 423, in handle_read_event
    self.handle_read()
  File "/usr/local/lib/python3.6/site-packages/cassandra/io/asyncorereactor.py", line 438, in handle_read
    self.process_io_buffer()
Unable to print the message and arguments - possible formatting error.

cassandra-version:3.11.5

cassandra-驱动程序(python):3.14.0

有时 cassandra 会抛出上述错误,我不确定为什么会这样

我如何让它工作

问题是当您创建 Cluster 对象时,您将 port 参数作为字符串而不是数字传递...(参见 corresponding source code line