Python Forum

Full Version: need a little with python3.5 oprnibg other program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
  Sorry no code, been looking for some type of code to open and run other programs on win 7.
I made a very nice control program that does what ever I till it to do. One of the things I want
it to do is run exe programs. Is their a way to open and run, let say MS paint.
Thank you
renny

my code here
Quote:Is their a way to open and run, let say MS paint.
Use subprocess.
Open Ms paint.
C:\1
λ ptpython
>>> import subprocess

>>> subprocess.run(['mspaint.exe'])
Open a image in folder C:\1 with mspaint.
C:\1
λ ptpython
>>> import subprocess

>>> subprocess.run(['mspaint', 'C:/1/wx16.jpg'])
CompletedProcess(args=['mspaint', 'C:/1/wx16.jpg'], returncode=0)
Hey, snippsat that works very well Thank you very much .