1

I'm trying to run a python script on a remote jobserver using paramiko. I can run the program on the server, but my problem is that I can't send values to the python script via the command line. Is it possible to do this using paramiko as well? I need the python script to be running while getting these messages. For example I want to send a '1' for it to run certain parts of the python script. Is there a way to do so? I tried to see if a could just run: chan.exec_command('1'), but that didn't work. The code dealing with communication is below. I can also only use SSH to communicate with the server.

import paramiko
#import time
#from scp import SCPClient

def createSSHClient(server, port, user, password):
    client = paramiko.SSHClient()
    client.load_system_host_keys()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(server, port, user, password)
    return client

ssh = createSSHClient("host", 22, "user", "password")
sftp = ssh.open_sftp()
i = 1

ssh_transp = ssh.get_transport()
chan = ssh_transp.open_session()
chan.setblocking(0)
chan.exec_command('python ./Server/compute_haralick1.py') #Starting python     script on the remote server

If not using paramiko is there another way to send a message to this running python script?

Martin Jensen
  • 35
  • 1
  • 8

0 Answers0