我有一個燒瓶應用程序,當用戶單擊索引頁面上的按鈕時,它們會觸發(fā)生成報告,并使用 send_file() 函數(shù)將其下載到瀏覽器中。每次創(chuàng)建和下載報告時,服務器都會停止,我在終端中收到以下錯誤。每次都需要重新啟動,我不知道如何修復它。有任何想法嗎?:)flask_app.py 文件:from flask import Flask, render_template, request, url_for, flashimport create_reportfrom flask_debugtoolbar import DebugToolbarExtensionfrom flask import send_fileapp = Flask(__name__)filename = ""@app.route("/")def index(): return render_template("index.html")@app.route("/handle_data", methods=['GET', 'POST'])def handle_data(): text = request.form['accountinput'] preprocessed_text = text.lower() filename = create_report.start_script(preprocessed_text) path = "reports/" + filename return send_file(path, as_attachment=True)if __name__ == '__main__': app.run(debug=True)終端錯誤:Assertion failed: (NSViewIsCurrentlyBuildingLayerTreeForDisplay() != currentlyBuildingLayerTree), function NSViewSetCurrentlyBuildingLayerTreeForDisplay, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.60.100/AppKit.subproj/NSView.m, line 14485.
1 回答

縹緲止盈
TA貢獻2041條經(jīng)驗 獲得超4個贊
你應該開始你的程序
import matplotlib
matplotlib.use('Agg')
由于create_report模塊使用matplotlib,而對于matplotlib 這是一個常見的情況。
添加回答
舉報
0/150
提交
取消