I get the syntax error:
FileNotFoundError: [WinError 2] The system cannot find the file specified
when running the below code.
It is a little hard to find a good solution for this problem on windows which I am running as compared to UNIX which I can find working code for.
from subprocess import Popen, check_call
p1 = Popen('start http://stackoverflow.com/')
p2 = Popen('start http://www.google.com/')
p3 = Popen('start http://www.facebook.com/')
time.sleep(60)
for pid in [p1.pid,p2.pid,p3.pid]:
check_call(['taskkill', '/F', '/T', '/PID', str(pid)])
I want the code to open the pages for 60 seconds and then close them.
I know there is similar topic on the link:
, but firstly it is for python 2 and I have tried the codes using the subprocess module and they are identical to the code I am using which does not work.