I want to run a python script say test.py
on a Linux target machine (which has a python interpreter) and capture the output of the command in a text file as the part of another python script invoke.py
using paramiko
module.
The statement in the script
stdin, stdout, sterr = ssh.exec_command("python invoke.py > log.txt")
generates a blank file log.txt.
Please suggest corrections / alternate way to do this. to write the output to the file correctly.
test.py
when run locally outputs sane text (which is expected to be logged in log.txt).
There are some relevant posts here and here, but no one deals with output of python script