在 Windows 中终止子进程,访问被拒绝 [英] Terminate subprocess in Windows, access denied

查看:30
本文介绍了在 Windows 中终止子进程,访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

-

import time
import subprocess
from os.path import expanduser

chrome_path = expanduser('~Local SettingsApplication DataGoogleChromeApplicationchrome.exe')

proc = subprocess.Popen(chrome_path)
time.sleep(4)
proc.terminate()

输出:WindowsError: [错误 5] 访问被拒绝

如何终止 Chrome 进程?

How can I kill the Chrome process?

Windows XP 上的 Python 2.6.

Python 2.6 on Windows XP.

推荐答案

如果你使用 TASKKILL/F/PID [number of process ID] 会发生什么?试一试.通过导入操作系统启动它

what happens if you use TASKKILL /F /PID [number of process ID] ? Give it a try. Launch it through import OS

这篇关于在 Windows 中终止子进程,访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆