I've looked everywhere and I'm sorry if I'm missing the obvious, but I'm irritated out of my mind trying to find this solution.

All I want to do is start an application with arguments in a new window (cmd.exe or linux terminal). I don't care about piping the data from the window to python or vice versa...all I want is a new independent window running the application.

I've tried subprocess, os.system, os.popen, os.execvp, and many others, but they all seem to start the process in the background. I want to SEE the window...just start the application continue through the python script.

Any ideas?

Recommended Answers

All 6 Replies

You may have already tried this while trying os.system but in windows (Idk about linux/others) this works:


You should be able to start any application in windows just by calling: start path_to_program arguments
Also, I assume you want to open a program that uses cmd.exe.
Edit: my bad for last line... answer in title

Member Avatar for leegeorg07

also you could try webbrowser


import webbrowser

Under linux/KDE, I was able to start a program in a terminal like this

>>> import subprocess
>>> child = subprocess.Popen("konsole -e python foo.py", shell=True)

It also works with xterm instead of konsole if you're not using KDE.

how can i send arguments to the foo.py program using popen?? ....@Gribouillis
thanks in advance

how can i send arguments to the foo.py program using popen?? ....@Gribouillis
thanks in advance

Here is an example with gnome-terminal and program arguments

import subprocess as sp
sp.Popen('gnome-terminal -e "python lingo.py foo bar baz"', shell=True)

gnome-terminal has several other options which could be set, like working directory, zoom factor, title, configuration file, etc.

This is the easiest way I know.

import os
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.