请帮帮我。我正在 gcloud 上部署我的代码。在 gcloud 上成功部署我的 Flask 应用程序后,当我通过插入 youtube url 开始运行以下载视频时,此错误显示为“应用程序中的错误:/[POST] 上的异常”
2021-03-27 16:33:32 default[20210327t060338] "GET /" 200
2021-03-27 16:33:32 default[20210327t060338] "GET /static/form.css" 200
2021-03-27 16:33:32 default[20210327t060338] "GET /static/background.png" 200
2021-03-27 16:33:38 default[20210327t060338] Revieve URLs and start working...:
2021-03-27 16:33:38 default[20210327t060338] 8c4028-REpE
2021-03-27 16:33:41 default[20210327t060338] [2021-03-27 16:33:41,112] ERROR in app: Exception on / [POST]
2021-03-27 16:33:41 default[20210327t060338] Traceback (most recent call last): File "/env/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app response = self.
full_dispatch_request() File "/env/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/env/lib/python3
.7/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/env/lib/python3.7/site-packages/flask/_compat.py", line 39, in rer
aise raise value File "/env/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/env/lib/python3.7/site-
packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/vmagent/app/app.py", line 58, in index clip
= mp.VideoFileClip(id) File "/env/lib/python3.7/site-packages/moviepy/video/io/VideoFileClip.py", line 91, in __init__ fps_source=fps_source) File "/env/lib/python3.7/sit
e-packages/moviepy/video/io/ffmpeg_reader.py", line 36, in __init__ fps_source) File "/env/lib/python3.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 257, in ffmpeg
_parse_infos proc = sp.Popen(cmd, **popen_params) File "/opt/python3.7/lib/python3.7/subprocess.py", line 800, in __init__ restore_signals, start_new_session) File "/
opt/python3.7/lib/python3.7/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file
or directory: './.local/lib/python3.7/site-packages': './.local/lib/python3.7/site-packages'
这是我的代码:
@app.route('/', methods=["GET", "POST"])
def index():
if request.method == "POST":
attempted_url = request.form['url']
print('Revieve URLs and start working...:')
url = request.form['url']
id = extract.video_id(org_url)
print(id)
yt = YouTube(url)
video = yt.streams.get_lowest_resolution()
vdname = video.download()
os.rename(vdname, id)
return render_template('index.html')
if __name__ == "__main__":
app.run(host="127.0.0.1",port=8080,debug=True)