I have an Ubuntu server which has a python script that runs a terminal command-based interface. I'm using plink to login and immediately execute the python script:
plink.exe -ssh -l goomuckel -pw greenpepper#7 192.168.1.201 "python server.py"
However, I get the following message:
TERM environment variable not set.
So I created a sh script (server.sh) on the Ubuntu machine:
export TERM=xterm
python server.py
Using the following plink command:
plink.exe -ssh -l goomuckel -pw greenpepper#7 192.168.1.201 "sh server.sh"
Now I don't receive the warning anymore, it seems that the python script is execute. But instead of showing the terminal interface I'm printing in the python script, only the following characters are printed:
←[H←[2J
The weird thing is, when logging in manually with Putty and executing the python script, everything works fine. I've tried adding the -t flag to plink and then the script executes. However I'm using colors for printing the terminal text, and the colors are printed as text rather than changing the colors of the text as observed in Putty.
Any ideas what I can do?