maheshg
maheshg

Reputation: 339

python script exits when a shell command(to terminate a different tool) is run from os.system()

I am running a shell command from within my python script using

os.system("some shell command")

This command essentially terminates a tool. I need to check that this tool is terminated in my script.

But as soon as the tool is terminated the script is terminated too!

Upvotes: 0

Views: 164

Answers (2)

garnertb
garnertb

Reputation: 9584

Your script is probably terminating correctly. Try adding the following line after your last line of code to illustrate to you that it is done.

raw_input('Press any key to exit.')

Upvotes: 1

a sad dude
a sad dude

Reputation: 2825

Is the script, by any chance, launched by that same tool? If yes, you need to run os.setsid() to stop being dependent on it.

Upvotes: 1

Related Questions