I have a GUI application from which I want to open new terminal windows:
cd /home/abc/
'). less /home/abc/def.txt
'). tried 1 with:
subprocess.Popen(shlex.split('gnome-terminal -x tcsh -c "cd /home/abc/"'))
problem: it opens a new terminal window and closes it immediately
tried 2 with:
subprocess.Popen(shlex.split('gnome-terminal -x tcsh -c "less /abc/def.txt"'))
problem: opens the file with less command as wanted, but closes the terminal window when " q
" is pressed to exit " less
".
Is there any way to make the new terminal windows stay alive?
I can give you a solution for your first problem. I tested it on Ubuntu 14.04.4 LTS:
import subprocess
cmd = "gnome-terminal --working-directory=/home/begueradj/Desktop"
subprocess.Popen(cmd1, shell=True)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.