user3826115 user3826115 - 5 months ago 11
Python Question

Using os.system() in Python is open a program, can't see window of launched program

I am trying to launch a program/GUI from within a python code.

From the terminal, I can get the program to launch by simply typing the program name. A few lines get outputted to the terminal, and then a separate window opens with the GUI.

I tried to emulate this in python by running

os.system("<program name>")

The typical output lines, as mentioned above, get printed to the console, but no window opens up with the GUI.

Can os.system() be used to execute programs that have their own separate window?


From the Python manual:

[os.system] is implemented by calling the Standard C function system()

That being said, you shouldn't have any problems launching a GUI application with os.system. I've just tried it myself and it works fine.

It also mentions in the manual that:

The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function.

Maybe that's worth a try. Do any other GUI applications work when you spawn them with os.system?