繁体   English   中英

Python无法打开文件

[英]Python can't open file

我有一个PHP脚本应该以用户“apache”执行python脚本但是返回错误:

/transform/anaconda/bin/python: can't open file '/transform/python_code/edit_doc_with_new_demo_info.py': [Errno 13] Permission denied

edit_doc_with_new_demo_info.py权限是---xrwx--x. 1 apache PosixUsers 4077 Sep 18 12:14 edit_doc_with_new_demo_info.py ---xrwx--x. 1 apache PosixUsers 4077 Sep 18 12:14 edit_doc_with_new_demo_info.py 调用此python脚本的行是:

shell_exec('/transform/anaconda/bin/python /transform/python_code/edit_doc_with_new_demo_info.py ' . escapeshellarg($json_python_data) .' >> /transform/edit_subject_python.log 2>&1')

如果apache是python文件的所有者并且所有者具有执行权限,那么它怎么能无法打开文件?

Python解释器必须打开文件进行读取 ,因此执行和读取位都是必需的。 尝试这个:

$ chmod 550 /transform/python_code/edit_doc_with_new_demo_info.py

您需要读取权限才能运行python脚本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM