Python Forum
how to open program file .exe from list - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to open program file .exe from list (/thread-23075.html)



how to open program file .exe from list - SayHiii - Dec-10-2019

here is my code
    if mybuffer == "b'Open'":
        print("Program is Opening")
        your_Po = (r'C:\Qt\5.13.1\mingw73_32\bin\designer.exe')
        fp = os.popen(your_Po) #use os.popen for get out from loop
but if i have 3 program with different path how I can open it with list of my 3 path of program?

like this your_Po = ('C:\Qt\5.13.1\mingw73_32\bin\designer.exe' , 'C:\Qt\5.13.1\mingw73_32\bin\designer1.exe',
'C:\Qt\5.13.1\mingw73_32\bin\designer2.exe')

Huh


RE: how to open program file .exe from list - snippsat - Dec-10-2019

Make a list and loop.
Use subprocess and not os.popen().
Example.
import subprocess

run_lst = [
    r"C:\Qt\5.13.1\mingw73_32\bin\designer.exe",
    r"C:\Qt\5.13.1\mingw73_32\bin\designer1.exe",
    r"C:\Qt\5.13.1\mingw73_32\bin\designer2.exe",
]

processes = [subprocess.Popen([cmd]) for cmd in run_lst]



RE: how to open program file .exe from list - SayHiii - Dec-11-2019

Thank you