How do I run multiple executables in python one after the other -


I'm still very new to Python and I'm still wrapping my head around everything that can is. I'm currently working on a small app to help me in my job. It's a graphical menu that lets me choose apps to install on a PC. I have a problem with two installers that run them (32 and 64 bit). I need the program to wait for the one to finish before starting the next one. How do I do this?

Here is the code ...

  DF ReturnsLUI (self, form): form .sitvindotite (_translate ("form", "form", none)) Self.label.setText (_translate ("form", "what do you want to install?", None)) self.adobe_reader.setText (_translate ("form", "Adobe Reader", none)) .flash Self.java_7.setText (_translate ("form", "java 7", none). Self.java_8.setText (_translate ("form", "stringslate" ("form", "flash", none) Java 8 ", none)) self.adobe_reader.clicked.connect (self.adobe) self.flash.clicked.connect (self.flash13) self .java_7.clicked.connect (self.java7) self.java_8.clicked connect (self.java8) def adobe (self): os.startfile ("c: \\ user \\ eric \\ desktop \\ install_reader_11.exe" ) Def flash13 (self): os.startfile ("C: \\ user \\ Eric \\ Desktop \\ install_flash_13_IE.exe") os.startfile ("C: \\ user \\ Eric \\ Desktop \\ install_flash_13_nonIE Exe ") def java7 (self): os.startfile (" c: \\ user \\ eric \\ desktop \\ install_java-7u71-x32 Exe ") os.startfile (" C: \\ user \\ Eric \\ Desktop \\ install_java-7u71-x64.exe ") def java8 (self): os.startfile (" C: \\ user \ eric \ \ Desktop \\ install_java-8u25-x32.exe ") os.startfile (" C: \\ user \\ Eric \\ desktop \\ install_java-8u25-x64.exe ")  

Code has been edited after Steve made changes ... After running an installer, I also get an error message in Python terminal (which starts to work).

  Def adobe (mycmd): Mycmd = r "C: \ user \ er Try \ "desktop \ install_reader_11.exe" to try: retcode = call (mycmd, shell = true) if the codec  sys.stderr, "the hair was eliminated by signal", -rect other : Print & gt; sys.stderr, "Returned hair", except the OSError Rate code: Print> System> Stderr, "Execution failure:", and Retcode = -1ReadDef Flash 13 (MyCMD): ICMD = R "C: \ user \ Eric \ Desktop \ install_flash_13_IE.exe" Try: retcode = call (mycmd, shell = true) If the codec is < 0: Print & gt; Sys.stderr, "The hair was eliminated by the signal", -Rect others: print & gt; Sys.stderr, "Returned hair", excluding OSError Rate code: Print & gt; & Gt; Sys Stderr, "Execution failure:", E Retcode = -1 return ratecode  

Error message ...

  Print & gt; & Gt; Sys.stderr, "Returns the hair", the ratecod type error: for unsupported typography type (s) & gt; & Gt ;: 'builtin_function_or_method' and '_io.TextIowrapper'  

Thanks!

everywhere you are using osstartfile (cmd) Use

  os.startfile ("C: \\ user \\ Eric \\ Desktop \\ whatever .exe")  

to

  subproc.close ("c: \\ user \\ eric \\ desktop \\ whatever .exe")  

The problem with using the osstartfile for the script is that it is not blocked. This means that your script does not wait to interact with the installers who pops up the user; It still continues, and it can pop up many installations simultaneously subprocesses Blocking call is it means that it waits for you to launch to launch, and your script when the installer is closed The correct backup will begin.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -