Python SSH not giving full output -


I am trying to write a script that logs to the remote machine, runs the command and gives output. I'm doing this in Python using Paramio Library. However, full production is not being produced for some reasons, only one line in it

In an attempt to separate the problem, I created a local script, which is called simple, which runs the command and sends the output to a file, remote_teast_output. Txt then i just file instead of sftp instead There is only one line in the file that is the only line of output every time: Command response code

When I do all this manually (ssh over, log, and run ./simple), it works as all and the output file is correct though, it is on my machine Through script, it only gives one line.

My code:

  ssh = paramiko.SSHClient () ssh.set_missing_host_key_policy (paramiko Kotoadpolisi ()) ssh.load_host_keys (os.path.expanduser (os.path .join ( "~", ".ssh", "known_hosts"))) ssh.connect (host, username, password) ssh_stdin, ssh_stdout, Ssh_stderr = ssh.exec_command ( 'LD_LIBRARY_PATH = / opt / bin ./simple \ N ') print "output:", ssh_stdout.read () + "end" # read the output of the command executed "err:", ssh_stderr. Read () # execute command error Stream reading sftp = ssh.open_sftp () sftp.get ( 'remote_test_output.txt', 'local_test_output.txt') sftp.close ()   

What is done back to: Feedback code: 128

What should be returned:

  Field 1: Value 1 field 2: value 2 response code: 128 field 3: value 3 field 4: value 4 etc.   

Does anyone have any idea that I try to call the call I'm not, is it normal output?

I have to go inside the LD_LIBRARY_PATH clause the convertible assignment or I do not have an error present in a library.

According to Prmico documents, "Exec_command" method gives a channel object is the first question: Do you have a Tried to set the bufsize parameter? Channel object "treated like socket" because it is stated in the documentation:

This means that recv () (and possibly (Reading)) read only buffer Must have read the existing data. So whenever your reading () returns the call, it does not mean that the process was already implemented on the remote side. Executes your order you should use exit_status_ready () method to check:

And then you can read all the data are good, this is what I I think I might be wrong, but right now I can not test my theory.

Comments