简体   繁体   English

如何使用Python CGI脚本杀死启动该脚本的浏览器?

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

I'm doing this in MacOs 10.4. 我正在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. 我的网页将一些数据发布到Python脚本中,我希望通过关闭浏览器来结束该脚本。 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 Apache error log I see the message: 在Apache错误日志中,我看到以下消息:

kill: (210) - Operation not permitted

Presumably the Apache server doesn't have permission to kill a process that I started. 大概Apache服务器无权终止我启动的进程。 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. 您应该有第二个脚本来启动Web浏览器,允许您粘贴数据-或自动化整个过程,因为如果需要,您可以使用“ selenium ”,并且该脚本不会关闭浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM