Your variable cats contains only the filename, I believe you need to send the full path to flask.send_file.
@app.route('/notok', methods=['GET'])
def asdfasd():
path='C:/tmp/'
cats = random.choice([
x for x in os.listdir(path)
if os.path.isfile(os.path.join(path, x))
])
print(cats)
return(flask.send_file( (os.path.join(path, cats))))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…