Python Forum
how to open program file .exe from list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to open program file .exe from list
#1
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
Reply
#2
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]
Reply
#3
Thank you
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python win32com.client: What are the syntax to open exe file & activate its window? JaneTan 0 205 Oct-14-2020, 09:09 AM
Last Post: JaneTan
  open(file, 'rb') raises UnicodeDecodeError binnybit 1 200 Sep-28-2020, 06:55 AM
Last Post: Gribouillis
  open vlc movie file on raspberrypi Nickd12 4 286 Sep-22-2020, 10:57 PM
Last Post: Nickd12
  What is meant by "truncates the file" RE file.open(w+b)? MysticLord 5 377 Sep-01-2020, 08:36 PM
Last Post: bowlofred
  How to open MIDI-file and get events in a list? philipbergwerf 2 430 Aug-01-2020, 10:58 AM
Last Post: philipbergwerf
  Can't open/read txt file in C extension for Python Rad226 8 711 Jun-26-2020, 04:08 PM
Last Post: Rad226
  Can't open file rdgbl 1 417 May-26-2020, 07:51 PM
Last Post: bowlofred
  How do I open a file and the plot it? HelixFossil 1 407 Apr-17-2020, 11:00 PM
Last Post: thirteendec
  Using online python for course, How do I open a File that's a link? WhatsupSmiley 1 554 Mar-20-2020, 06:56 AM
Last Post: buran
  How To Find an Opening and Closing String, Copying Open/Close/Contents to New File davidshq 1 475 Mar-03-2020, 04:47 AM
Last Post: davidshq

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020