subprocess.Popen is not executed on certain command

58 views Asked by At

I am trying to execute non-blocking cmd command. However, the command I want to run seems to be skip(doesn't do anything and just passes)

subprocess.Popen(["cmd", "/c", "C:/Program Files/BlueStacks_nxt/HD-Player.exe", "--instance", "Nougat32"], 
    shell=False, stdin=None, stdout=None, stderr=None, close_fds=True
)

Also tried to set shell=True but didn't work either. Command is executed if I add .communicate() or just use os or subprocecss.run() but not the wanted behavior since it blocks.

Tested out if opening a Txt file works and it did work fine -

subprocess.Popen(
    ["C:/Windows/Notepad.exe", "C:/Users/SomeUser/Desktop/File.txt"], 
    shell=False, stdin=None, stdout=None, stderr=None, close_fds=True
)

Any idea why this is happening and how to fix it?

Tried shell=True,False

1

There are 1 answers

0
LetzerWille On

try without "cmd" and "/c" subprocess.Popen will run the .exe.

subprocess.Popen(["C:/Program Files/BlueStacks_nxt/HD-Player.exe", "--instance", "Nougat32"], 
    shell=False, stdin=None, stdout=None, stderr=None, close_fds=True
)