user3744102
user3744102

Reputation: 31

Scripts quits after launching Popen command

  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

Answers (2)

user3766195
user3766195

Reputation:

The problem is due to wait(). if wait() is removed ,the script will continue

Upvotes: 2

Svend Feldt
Svend Feldt

Reputation: 778

Wait () will wait for the launched program to terminate. Without the wait your script will continue after launching

Upvotes: 3

Related Questions