我现在有这个代码...关闭后的entra线} ...
{
"menu" : {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{ "value" : "New", "onclick": "CreateNewDoc()" },
{ "value" : "Open", "onclick": "OpenDoc()" },
{ "value" : "Close", "onclick": "CloseDoc()" }
]
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个flask应用程序,当用户单击索引页面上的按钮时,他们会触发要生成的报告,并使用send_file()函数将其下载到他们的浏览器中。
每次创建并下载报告时,服务器都会停止运行,并且在终端中出现以下错误。每次都需要重新启动它,我不知道如何解决它。有任何想法吗?:)
flask_app.py文件:
from flask import Flask, render_template, request, url_for, flash
import create_report
from flask_debugtoolbar import DebugToolbarExtension
from flask import send_file
app = 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)
Run Code Online (Sandbox Code Playgroud)
终端错误:
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.
Run Code Online (Sandbox Code Playgroud) 仅当我尝试使用数据框中 multinomialnb_label 值的 value_counts() 绘制条形图时,有时才会收到此错误。其他时候还好。我不知道如何修复错误。
它是烧瓶应用程序的一部分,一切正常,直到它上线:
my_plot = multinomialnb_count.plot(kind='bar', legend=None)
Run Code Online (Sandbox Code Playgroud)
这是 multinomialnb_count 的详细信息:
[1395 rows x 15 columns]
bug report 721
question 492
praise 112
noise 49
other feedback 21
Name: multinomialnb_label, dtype: int64
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
import matplotlib
matplotlib.use('Agg')
import pandas as pd
import numpy as np
import pymysql.cursors
import sqlalchemy
import datetime
import sys
import re
from wordcloud import WordCloud, STOPWORDS
import preprocessor as p
import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
from nltk.collocations import * …Run Code Online (Sandbox Code Playgroud)