1 回答

TA贡献1111条经验 获得超0个赞
os.listdir返回相对路径。所以一个最小的修复是:
df=pandas.read_csv(os.path.join(app.root_path, app.config['UPLOAD_FOLDER'], databpe))
ch=pandas.read_csv(os.path.join(app.root_path, app.config['UPLOAD_FOLDER'], datach))
更好的重构是:
def get_uploads():
databpe_path = os.path.join(app.root_path, app.config['UPLOAD_FOLDER'], 'bpe.csv')
datach_path = os.path.join(app.root_path, app.config['UPLOAD_FOLDER'], 'ch.csv')
if os.path.isfile(databpe_path) and os.path.isfile(datach_path):
df=pandas.read_csv(databpe_path)
ch=pandas.read_csv(datach_path)
flash("check desktop","success")
return render_template("page3.html")
添加回答
举报