开发者

How can I use a Python cgi script to kill the browser that launched it?

开发者 https://www.devze.com 2023-02-24 08:56 出处:网络
I\'m doing this in MacOs 10.4. My web page posts some data to a Python script, and I would like the script to finish off by shutting down the browser. I am trying to do this calling

I'm doing this in MacOs 10.4. My web page posts some data to a Python script, and I would like the script to finish off by shutting down the browser. I am trying to do this calling

os.system("kill 210")   # where 210, say, is the browser's id number

but this doesn't work. In the Apa开发者_JAVA百科che error log I see the message:

kill: (210) - Operation not permitted

Presumably the Apache server doesn't have permission to kill a process that I started. Is there a way to give it permission, or a better way of doing this?


How are you starting your web browser?

You should have a second script that would start the web browser, allow you to paste data - or automate the whole process, for that you could use "selenium" if you want and this script would have no issues with closing the browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消