热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

pythontwisted.internet.reactor.spawnProcess引发OSError(13,’权限被拒绝’)

当我尝试通过`twisted.internet.reactor.spawnProcess’运行python脚本时:fromtwisted.internetimportprotoco

当我尝试通过`twisted.internet.reactor.spawnProcess’运行python脚本时:

from twisted.internet import protocol, reactor
class ProcessProtocol(protocol.ProcessProtocol):
def connectionMade(self):
self.transport.closeStdin()
def childDataReceived(self, childFD, data):
print data
def main():
proto = ProcessProtocol()
cmd = ['/var/projects/python/worker.py']
reactor.spawnProcess(proto, cmd[0], cmd)
if __name__ == "__main__":
exit(main())

我收到以下错误:

Upon execvpe /var/projects/python/worker.py ['/var/projects/python/worker.py', '5'] in environment id 29011152
:Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/Twisted-11.0.0-py2.6-linux-x86_64.egg/twisted/internet/process.py", line 414, in _fork
executable, args, environment)
File "/usr/local/lib/python2.6/dist-packages/Twisted-11.0.0-py2.6-linux-x86_64.egg/twisted/internet/process.py", line 460, in _execChild
os.execvpe(executable, args, environment)
File "/usr/lib/python2.6/os.py", line 353, in execvpe
_execvpe(file, args, env)
File "/usr/lib/python2.6/os.py", line 368, in _execvpe
func(file, *argrest)
OSError: [Errno 13] Permission denied

解决方法:

您可能没有执行’/var/projects/python/worker.py’的权限,或者未设置脚本的execute位.是否执行ls -l /var/projects/python/worker.py并进行检查?


推荐阅读
author-avatar
平凡小柏
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有