首页 > 解决方案 > “make”命令权限被拒绝

问题描述

我有一个 Django 应用程序,它有一个我命名的自定义文件夹codefiles。在其中,有许多随机名称的子文件夹。此外,在每个文件夹中,都有一个 Makefile。我目前很困惑为什么OSError: [Errno 13] Permission denied当我调用以下代码时它会说:

p = subprocess.Popen(["make", "-f", os.path.join(directory, "Makefile")], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True, shell=True)

这里可能有什么问题?

编辑:即使调用下面的代码也会导致 Permission denied 错误:

current_directory = os.getcwd()
logging.debug("current_dir: " + str(current_directory));

EDIT2:这越来越奇怪了。即使是评论也会导致 Permission denied 错误。这是错误日志:

File "./src/tasks/views.py", line 1178, in test_run_code
# create the make file
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied

标签: pythondjangomakefilegnu-make

解决方案


推荐阅读