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?
Asked
Active
Viewed 258 times
1
-
isn't this what you want ? https://stackoverflow.com/questions/35545402/how-to-run-an-ipynb-jupyter-notebook-from-terminal – hossein hayati Apr 05 '20 at 22:37
-
Not exactly. In the script I want to be able to run a command in a remote server. – formicaman Apr 05 '20 at 23:53
1 Answers
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