WindowsError [错误5]访问被拒绝 [英] WindowsError [error 5] Access is denied

查看:290
本文介绍了WindowsError [错误5]访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用killableprocess软件包(在子流程之上构建)来运行流程 每当我在脚本中运行"killableprocess.Popen(command)"代码段时,都会出现以下错误:

I'm using the killableprocess package (built on top of subprocess) for running processes Whenever I run the "killableprocess.Popen(command)" piece of code in my script I get the following error:

File "killableprocess.py", line 157, in _execute_child
  winprocess.AssignProcessToJobObject(self._job, hp)
File "winprocess.py", line 37, in ErrCheckBool
  raise WinError()
WindowsError [error 5] Access is denied
Exception TypeError: "'NoneType' object is not callable" in <bound method AutoHANDLE.__del__ of <AutoHANDLE object at 0x025D42B0>> ignored

但是当我从python交互式控制台(python 2.6)运行它时,它可以正常工作. 这可能意味着从脚本运行此脚本时会出现权限问题,但我不知道如何解决.我尝试从以管理员身份运行的cmd上运行脚本,但这无济于事. 试图寻找类似的帖子,但没有找到任何好的解决方案.希望在这里找到帮助 如果有帮助,我将在Windows上运行,尤其是Windows 7 Ultimate x64.

But when I run it from the python interactive console (python 2.6) it works fine. That probably means there are permission issues when I run this from the script, but I don't know how to solve them. I tried running the script from a cmd that I ran as administrator, but it didn't help. Tried looking for similar posts but didn't find any good solution. Hope to find some help here I'm running on Windows, specifically Windows 7 Ultimate x64, if it's any help.

谢谢

推荐答案

我通过切换到进程目录(我尝试使用inkscape)解决了类似的问题,并且解决了我的问题

I solved a similar problem I had by switching to the process directory (I was trying to use inkscape) and it solved my problem

import subprocess
inkscape_dir=r"C:\Program Files (x86)\Inkscape"
assert os.path.isdir(inkscape_dir)
os.chdir(inkscape_dir)
subprocess.Popen(['inkscape.exe',"-f",fname,"-e",fname_png])

也许切换到进程目录也对您有用.

Maybe switching to the process directory will work for you too.

这篇关于WindowsError [错误5]访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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