Reputation: 4907
When I connect a Paramiko client, I get output I don't need:
Connected (version 2.0, client OpenSSH_7.2p2)
Authentication (publickey) failed.
Authentication (publickey) failed.
Authentication (password) successful!
I tried to suppress the stdout as suggested in this question, but it doesn't work:
sys.stdout = open(os.devnull, "w")
print("AAAAAAAAAAAaaaaaaaaaaaaaaaaa")
my_client.connect(hostname=hostname, username=username, password=password)
sys.stdout = sys.__stdout__
The "AAAAAAAAAAAaaaaaaaaaaaaaaaaa" does NOT appear, but the output from Paramiko still does. How do I stop Paramiko's info from printing to the console?
Upvotes: 0
Views: 745
Reputation: 202088
Paramiko does not print anything to the console on its own.
Paramiko sends those messages to a logger (logging module). If they end up on the console, you must have a logger configured that sends the log messages to the console.
Upvotes: 1