linux - How to redirect output of ssh.exec_command to a file in Python paramiko module? -
i want run python script test.py
on linux target machine (which has python interpreter) , capture output of command in text file part of python script invoke.py
using paramiko
module.
the statement in script
stdin, stdout, sterr = ssh.exec_command("python invoke.py > log.txt")
generates blank file log.txt.
please suggest corrections / alternate way this. write output file correctly.
test.py
when run locally outputs sane text (which expected logged in log.txt).
there relevant posts here , here, no 1 deals output of python script