WindowsError [错误 5] 访问被拒绝
我正在使用killableprocess包(构建在子进程之上)来运行进程 每当我在脚本中运行“killableprocess.Popen(command)”代码时,我都会收到以下错误:
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,如果有帮助的话。
谢谢
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
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.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我通过切换到进程目录解决了类似的问题(我试图使用 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
Maybe switching to the process directory will work for you too.
我在使用 subprocess 模块遇到此问题时发现,“args”中的第一个条目(subprocess.Popen() 的第一个参数)只需是没有路径的可执行文件名称,我需要将参数列表中的
executable
设置为我的可执行文件的完整路径。What I found when running into this with the subprocess module is that the first entry in 'args' (the first parameter to
subprocess.Popen()
) needed to be just the executable name with no path and I needed to setexecutable
in the argument list to the full path of my executable.确保您的路径包含可执行文件的名称 (inkscape.exe)
Make sure that your paths include the name of the executable file (inkscape.exe)
或者,如果您的模块不起作用,您可以使用“subprocess”模块:
Alternatively, if your module doesn't work, you can use the «subprocess» module:
您是否指定要传递给
Popen
的可执行文件的完整路径(argv
中的第一项)?Do you specify full path to executable you are passing to
Popen
(the first item inargv
)?