Linked Questions

6274 votes
66 answers
5.2m views

How do I execute a program or call a system command?

How do I call an external command within Python as if I had typed it in a shell or command prompt?
freshWoWer's user avatar
  • 64.6k
1 vote
2 answers
4k views

How do I execute a python program within a python program? [duplicate]

Now Consider the following idea I'm declaring a if/elif type to run the program Such as : number=int(input("Enter a number :")) If number ==0 Run program.py Elif number ==1 Run Program2.py Else ...
Vinayak Jaiwant's user avatar
1 vote
2 answers
984 views

How to run a program in command line from python [duplicate]

Possible Duplicate: How do I execute a program from python? os.system fails due to spaces in path I am trying to call a program (MP3gain.exe) in command line from python. my problem is that python ...
user1432738's user avatar
-1 votes
1 answer
960 views

How can I run Powershell and run .exe file by Python code? [duplicate]

Currently, I am running an exe file (test.exe) by Powershell. It requires an input file's name as an argument. It means, I have to type ./test.exe input.txt in Powershell command in order to run the ...
Jaesung's user avatar
32 votes
5 answers
59k views

os.system to invoke an exe which lies in a dir whose name contains whitespace

My code is simply as follows: file = 'C:\\Exe\\First Version\\filename.exe' os.system(file) When I run this program, a Windows error is raised: can't find the file specified. I found out the problem ...
Synapse's user avatar
  • 1,644
15 votes
3 answers
142k views

How to open external programs in Python

Duplicate edit: no, i did that but it doesnt want to launch firefox. I am making a cortana/siri assistant thing, and I want it to lets say open a web browser when I say something. So I have done the ...
Dan's user avatar
  • 302
34 votes
2 answers
19k views

Launch a totally independent process from Python

I'm trying to launch a completely independent process from python. I can't use something simple like os.startfile since I need to pass arguments. Currently I'm using subprocess.popen which gets me 90%...
greenhat's user avatar
  • 1,081
6 votes
4 answers
9k views

How to execute a shell command through Python

I am new to Python programming. I want to execute a shell command "at" from a Python program. Can any one of the Python gurus help me out? Thanks in advance.
hue's user avatar
  • 1,807
5 votes
1 answer
13k views

how do I make a fork or non-blocking system call in python

This is related to this question but with a different take. In Ubuntu, I use Autokey, which uses python to automate keystrokes it observes. So I have <super>+e mapped to open Gedit, <shift&...
Krista K's user avatar
  • 22k
5 votes
2 answers
14k views

How to take a screenshot with Python using a click and drag method like Snipping Tool?

I'm writing a Python program that is basically the Snipping Tool. I'd like to be able to run my program, select the area for my screenshot using my mouse to click and drag, and then have the program ...
ATP's user avatar
  • 643
5 votes
2 answers
11k views

How to determine if win32api.ShellExecute was successful using hinstance?

I've been looking around for an answer to my original issue.. how do i determine (programmatically) that my win32api.ShellExecute statement executed successfully, and if a successful execution occurs, ...
CyberSamurai's user avatar
3 votes
1 answer
12k views

How to open an external application by pyautogui module in python with predefined window(x,y) position?

I want to open VM player application through python code and I have to import/open VM file but whenever I tried opening the application through subprocess.Popen(self.vmware_path) python code line, it ...
Santhosh's user avatar
2 votes
3 answers
4k views

Am I using os.system correctly? My application won't open anymore

A few days ago I had the line os.system(r"C:\Users\red\Desktop\Test UI") in my program. I tested it and it worked fine, it opened the application just like I wanted it to. Now, I'm coming ...
Kyle Clark's user avatar
3 votes
1 answer
6k views

Execute a Windows path with spaces in Python

I am trying to build a program that mimics the 'run' feature of Windows in a Windows environment. Now I know that sounds a bit silly, but we are on 'limited' computers, and the cmd is completely ...
Rabbi Shuki Gur's user avatar
1 vote
4 answers
9k views

Can I tell Python to execute command line in cmd?

I'm working on a personal project as a very amateur programmer and to do this, I need to have python tell cmd to run an external program via command line. For example, I need to chdir ("C:\blah\blah")...
Fishtallen's user avatar

15 30 50 per page