Exception ignored in: <function BufferedFile.__del__ at 0x7f4886fbd160> Traceback (most recent call last): File "/usr/local/python3/lib/python3.8/site-packages/paramiko/file.py", line 67, in __del__ File "/usr/local/python3/lib/python3.8/site-packages/paramiko/channel.py", line 1390, in close File "/usr/local/python3/lib/python3.8/site-packages/paramiko/channel.py", line 989, in shutdown_write File "/usr/local/python3/lib/python3.8/site-packages/paramiko/channel.py", line 965, in shutdown File "/usr/local/python3/lib/python3.8/site-packages/paramiko/transport.py", line 1920, in _send_user_message AttributeError: 'NoneType' object has no attribute 'time'
这种只需要在代码最后加上
stdin.close()
最终代码可以这样
import paramiko import os import pymysql import cx_Oracle import sys from subprocess import Popen, PIPE kafka_ogg_path = "/home/db/grid/base/BIGDATA_OGG/ogg21" # ssh 连接到kafka复制进程服务器操作 # 创建ssh对象 ssh = paramiko.SSHClient() # 须臾连接不在~.ssh/known_hosts 目录中的主机 ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # 连接服务器 ssh.connect(hostname='10.25.2.222', port=22, username='grid') commin_list =['start *'] # 执行命令 stdin, stdout, stderr = ssh.exec_command('echo "start * "| /home/db/grid/base/ORACLE_OGG/ogg21/ggsci') stdin.close() # 关闭服务器连接
- 39 AttributeError attribute 模块 paramiko39 attributeerror attribute模块 39 quot attributeerror attribute 39 attributeerror attribute nonetype 39 attributeerror tensorflow attribute 39 attributeerror antialias attribute 39 attributeerror attribute copy_src 39 attributeerror attribute深度 v_flag_cb_issuer_check 39 attributeerror attribute 39 attributeerror chatcompletion attribute 39 attributeerror relatedmanager attribute