0

I wrote a script based on This answer.

import paramiko

ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.connect('1.1.1.1',username='admin',password='admin')
w,r,e = ssh.exec_command('ls ./home/')

print(''.join(r.readlines()))

ssh.close()

If it executes exec_command('ls ./home/'), it will return all files in that folder.

a.out
hello.cl
hello.cpp

If it executes exec_command('./home/a.out'), it returns nothing. I expect a string of 'hello world' or other error messages. [Solved, see the first answer]

If I type ./home/a.out in the terminal of the server, it outputs Failed to load kernel.. Yes, this is an OpenCL error message. Why this error message is not caught by paramiko? [Unsolved]

Community
  • 1
  • 1
GY_
  • 398
  • 3
  • 17

1 Answers1

0

While I am writing this question, I suddenly realized that I should try

exec_command('cd home; ./a.out')

It works! Such easy!

GY_
  • 398
  • 3
  • 17