1

I am using subprocess.Popen() to execute python scripts inside other python scripts, but for some reason, a cmd window appears as a subprocess as well. I wanted to know how to remove it. I know there are multiple questions about this topic (like this one), but I was unable to make it work, mainly because the slot I'm using to stop that cmd window from appearing is the same one I'm using to call the python script (Also, I'm new to the subprocess library, so I don't know any workarounds or any alternative libraries I can use)

This is the line of code I'm using

subprocess.Popen("Example.pyw", shell=True)
SaltyHelpVampire
  • 305
  • 2
  • 4
  • 15
  • Have you tried explicitly calling `Popen(["pythonw.exe", " – jedwards Jun 24 '18 at 18:06
  • I've tried this method and I haven't succeeded. I tried things like `subprocess.Popen("Example.pyw", "")` or `subprocess.Popen(["Example.pyw", ""])` (also using a path inside the second pair of quotation marks in both cases) and nothing worked – SaltyHelpVampire Jun 24 '18 at 18:53
  • 1
    Sorry if I wasn't clear, but I mean `Popen(["pythonw.exe", "Example.pyw"])` -- with `pythonw.exe` (not `python.exe`) as the first element of the args list. – jedwards Jun 24 '18 at 19:04
  • Thx! Helped a lot – SaltyHelpVampire Jun 25 '18 at 19:22

0 Answers0