Screen is returning the message: “Must be connected to a terminal.”
I am running a Java program, and with the Java program, I run a Python script. The python script (with subprocess.Popen) runs the command
screen -x hg1 -X stuff "jsp sign edit status1 2 test line $(printf '\r')"...but when it does that, it retuns the error
Must be connected to a terminal.I tried doing many things, including doing a bunch of switches (e.g. -dm, -d, -m, etc.), but none of them work.
How do I make screen stuff a command without giving me that error?
52 Answers
I think your problem is that you don't have an interactive shell terminal session from inside the python script; there's no tty allocated. You might want to try the python pty module.
If you already had an interactive terminal, you could try script /dev/null, then screen.
Try this:
screen -dm -x hg1 -X stuff "jsp sign edit status1 2 test line $(printf '\r')"You can find more infos here: