Reputation: 31
while True:
command = 'cmd /c start chrome http://google.com'
subprocess.Popen(command)
time.sleep(120)
When i try to launch the browser chrome using this code in python, the browser launches but after that my script quits. Is there a way to launch the browser and move on to process next block of codes.
I tried changin/c
to /K
and using subprocess.Popen(command, stdout=subprocess.PIPE).wait()
but in this case it will neither quit nor process the next block of codes
Upvotes: 1
Views: 81
Reputation:
The problem is due to wait(). if wait() is removed ,the script will continue
Upvotes: 2
Reputation: 778
Wait () will wait for the launched program to terminate. Without the wait your script will continue after launching
Upvotes: 3