Sterling Butters Sterling Butters - 5 months ago 45
Python Question

SSH Command using Paramiko: no output files

I have a command that I would like to run over ssh. I am using paramiko to connect and run the command and I don't get any error messages however the commands that I run are supposed to generate some output files (of which there are none when I check). Below is my code (I have replaced the actual server name, username, and password for obvious reasons):

import paramiko

ssh = paramiko.SSHClient()
ssh.connect("server", username="username",password="password")
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command("module load studsvik")
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command("casmo4 -k 0.0_file.inp")

#output = ssh_stdout.readlines()

My ultimate goal is to generate these files using the command given and transfer them to my local machine however no output files are generated when they would be otherwise using ssh in terminal.


Ended up using pexpect. Not as intuitive but got it to work