Search code examples
pythonpython-3.xsubprocesspython-os

run os.system commands on a new terminal- Python 3


I am running a program which allows me to run terminal commands through my Python code which takes input from the user through the command line. This is the part of the code where I open Google-Chrome

import sys
import os 
os.system("google-chrome") #I have Ubuntu 16.04

It opens the browser but the problem is that the terminal on which my python code is running becomes the same as the one where Chrome is running which means that I cannot give further input to my Python code. To solve this problem I need the Chrome to run as a process on a different terminal. I tried using subprocess.call("google-chrome", shell=True) but it did not open it on a new terminal.

How do I make the process run on a different terminal?


Solution

  • can this solve your problem?

    os.system('gnome-terminal -x chromium-browser')