V
V
vladqwelkj2020-09-06 16:53:51
linux
vladqwelkj, 2020-09-06 16:53:51

How to get text from terminal using python?

On the site you need to display all the information from the terminal, which appears if you run tmux attach on the server.
What is the best way to do this? I tried the Paramiko module, but writes:open terminal failed: not a terminal

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-09-06
@vladqwelkj

The problem needs to be solved in a different way. What is run in tmux should be run with output to a file. And display the result of parsing this file on the site. The file itself can be taken via ssh with a key, or you can run the tail command remotely:

ssh -i my_id_rsa_key [email protected] tail /tmp/script.log

Running in tmux and then messing around with the interactive shell is overkill.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question