[英]AssertionError: PORT is not a number (in Python)
when i using ssh tunnel to access mySQL db, why always show this error on remote_bind_address ?当我使用 ssh 隧道访问 mySQL 数据库时,为什么总是在remote_bind_address上显示此错误?
AssertionError: PORT is not a number
here is my code:这是我的代码:
with SSHTunnelForwarder(
(self.ssh_host, self.ssh_port), # Remote server IP and SSH port
ssh_username=self.ssh_username,
ssh_private_key=self.ssh_pkey,
remote_bind_address=(self.host_mysql, self.port_mysql)
) as server:
server.start() # start ssh sever
print('Server connected via SSH')
local_port = str(server.local_bind_port)
anyone can help me?任何人都可以帮助我吗? thanks before
谢谢之前
Probably the error occurs because the port you provide is of type string and not int.可能会发生错误,因为您提供的端口是字符串类型而不是 int。 Check it by printing
type(self.port_mysql)
before the problematic line.通过在有问题的行之前打印
type(self.port_mysql)
来检查它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.