1

I have a Python script on my local Jupiter notebook. Right now, I run a command on a Putty session to generate some data that I write to an output text file and the download to my local to be able to be read into the Python script. Is there any way to be able to write a command and do this from the script itself?

formicaman
  • 1,317
  • 3
  • 16
  • 32

1 Answers1

2

You can run the commands over ssh from python via paramiko library : https://www.paramiko.org

Example from the official documentation:

client = SSHClient()
client.load_system_host_keys()
client.connect('ssh.example.com')
stdin, stdout, stderr = client.exec_command('ls -l')
akazuko
  • 1,394
  • 11
  • 19