center os 中路径为什么不对 python

img

img

center os 中路径为什么不对 python //video, 本地可以使用

你打印一下这个当前你的路径看一下,是不是所在的目录,用这个函数打印一下看看。

import os
print(os.getcwd())


如果以上回答对您有所帮助,点击一下采纳该答案~谢谢

问题点:文件路径错误
不同系统下,文件路径的连接符号建议改成 os.sep,不一定是//.

FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg -i /root/data/www/python-flask/src/video/真实的程序员敲代码.mp4 -i /root/data/www/python-flask/src/video/真实的程序员敲代码.mp3 -c:v copy -c:a aac -strict experimental /root/data/www/python-flask/src/video/真实的程序员敲代码output.mp4 -y'
[pid: 26477|app: 0|req: 3/3] 27.189.227.123 () {46 vars in 802 bytes} [Mon Jul 17 12:16:00 2023] POST /get/video => generated 265 bytes in 957 msecs (HTTP/1.1 500) 4 headers in 165 bytes (1 switches on core 0)

python线上的 ffmpeg 总是报这个错