On Windows, the python subprocess command to open a cmd window is simply:
import subprocess
subprocess.Popen('cmd.exe')
Can anyone tell me what the command to open the cmd equivalent in Linux is? I'm going to be copying some python code from my Windows machine to my Raspberry Pi and am new to Linux - I know that this line of code won't open the terminal on a Linux OS the same way it will on Windows.
Thanks in advance!
2 Answers 2
Replace cmd.exe with gnome-terminal in order to open a terminal on Linux
2 Comments
xfce4-terminal on XFCE or konsole on KDE, etc.Different distros use different terminal programs. xterm should work on just about everything, so you could Popen('xterm') and then require the people figure out how to get xterm on their system if its not there by default.
shell=Trueto execute shell commands from Python. I recognize that might not be your end-goal, however, so that might not be helpful to you.