1

kill() or terminate() both work, if the Popen and them are directly under each other, but if I put in sleep, it doesnt work.

pro = subprocess.Popen(["C:\Program Files\VideoLAN\VLC\VLC.exe",r'e:\Download\PUA elit.xspf'],shell=True)
time.sleep(4)
pro.kill()

I tried closing it with os.system, but the pro.pid is different from the Task Manager process ID, and they are both different number every time I open it.

os.system("TASKKILL /F /PID {}".format(pro.pid))

I dont wanna close it by name, because then it closes all VLC windows, not just the one I just opened.

os.system("TASKKILL /F /PID {}".format("vlc.exe"))

How would you close the specific VLC window?

Chris
  • 951
  • 10
  • 26

0 Answers0