0

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?

6
Contributors
6
Replies
9
Views
8 Years
Discussion Span
Last Post by inuasha
0

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

os.system("start")

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

0

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.

0

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.

0

This is the easiest way I know.

import os
os.startfile(r"%windir%\system32\cmd.exe")
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.