[英]OSError: [Errno 2] No such file or directory : [python script] inside php shell_exec [ AWS-Lambda]
I am running PHP in a lambda function using a node.js wrapper. 我正在使用node.js包装器在lambda函数中运行PHP。 This is the python code I am running inside my PHP code using shell_exec.
这是我使用shell_exec在PHP代码内部运行的python代码。
shell_exec($bin_path .' '. __DIR__ . "/ffprobe_hosts.py " . $video_url);
Inside ffprobe_hosts.py 内部ffprobe_hosts.py
scene_ps = subprocess.Popen(("/usr/bin/ffprobe",
"-show_frames",
"-of",
"compact=p=0",
"-f",
"lavfi",
"movie=" + src_video + ",select=gt(scene\," +
str(threshold) + ")"),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
And this is the error which I am getting 这是我得到的错误
2018-05-04T10:26:54.021Z a8bfb250-4f85-11e8-bea2-f1c1fe029cf0
STDERR: boundaries = extract_shots_with_ffprobe(sys.argv[1])
File "/var/task/3rdparty/ffprobe/ffprobe_hosts.py", line 30, in
extract_shots_with_ffprobe
stderr=subprocess.STDOUT)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
In the error it is mentioned 'No such file or directory, I am not sure which directory there are mentioning. 错误中提到“没有这样的文件或目录,我不确定其中提到哪个目录。
The stack trace tells you that your Python script fails at line 30 where you call a function extract_shots_with_ffprobe(sys.argv[1])
. 堆栈跟踪告诉您Python脚本在第30行失败,在此调用函数
extract_shots_with_ffprobe(sys.argv[1])
。 sys.argv[1]
is the first command-line argument to your Python script, ie $video_url
. sys.argv[1]
是Python脚本的第一个命令行参数,即$video_url
。 So the value of that variable is not a path that points to an existing file on the file system. 因此,该变量的值不是指向文件系统上现有文件的路径。
将/usr/bin/ffprobe
更改为ffprobe二进制路径/var/task/ffprobe
可以修复错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.