给出绝对路径而不是相对路径
php函数调用python脚本:
$py_script = escapeshellcmd("/home/manish/anaconda2/bin/python /opt/lampp/htdocs/frontend/master/python_features/audioAnalysis.py featureExtractionFile -i /opt/lampp/htdocs/frontend/master/uploads/rihana.wav -mw 0.5 -ms 0.5 -sw 1 -ss 1 -o /opt/lampp/htdocs/frontend/master/output/rihana_op");
exec($py_script);
Error : Error: file not found or other I/O error. (DECODING FAILED)
相同的脚本在终端上运行并提供所需的输出
manish@manish-Vostro-3446:$ /home/manish/anaconda2/bin/python /opt/lampp/htdocs/frontend/master/python_features/audioAnalysis.py featureExtractionFile -i /opt/lampp/htdocs/frontend/master/uploads/rihana.wav -mw 0.5 -ms 0.5 -sw 1 -ss 1 -o /opt/lampp/htdocs/frontend/master/output/rihana_op
Short-term CSV file: /opt/lampp/htdocs/frontend/master/output/rihana_op_st.csv saved
所以我的问题是如何通过php而不是终端
执行相同的脚本答案 0 :(得分:0)
对于其他遇到此问题的人。我有同样的事情,但是还有一个RunTimeWarning关于无法找到ffmpeg的信息。安装完ffmpeg后,该错误也消失了。
对于Mac:
brew install ffmpeg
对于Linux:
sudo apt install ffmpeg