How can I open another linux terminal to output various types of debugging information in python?

I need to output various information to different terminal instances, and not print them in the same output stream, for example std.err or std.out.

for example: I have 5 types of information that say that AE needs to be displayed in different terminal windows on the same desktop, looks like

[terminal 1] - to display information A

[terminal 2] <- to display information B

[terminal 3] <- to display information C

[terminal 4] <- to display information D

[terminal 5] <- to display information E

I know that I can output them to different files, then open the terminals, read the file in a loop, but I want the python program to open the terminal by the program itself and print them directly when necessary.

Is it possible?

Thank!

KC

[edit] The best solution for this case is to use SOCKET as IPC, I think if the resource does not matter, it will work with the best compatible features - client server mode. and the pipe / subprocess will also be useful solutions on the same platform.

+3
source share
2 answers

Open the tube, then open the terminal on which it is catreading from the end of reading and writing to the end of the recording.

+3

subprocess, - , , "cat", . Popen. stdin = subprocess.PIPE Popen. stdin .

- (untested!):

import subprocess
p = subprocess.Popen('xterm -e "cat > /dev/null"', stdin=subprocess.PIPE)
p.stdin.write("Hello World!")
+1

Source: https://habr.com/ru/post/1747639/


All Articles