Skip to content

Commit

Permalink
scatterplot: try/except recovered
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeboucas committed May 15, 2020
1 parent e48bd75 commit ff00e0e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions flaski/apps/routes/scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,21 @@ def scatterplot(download=None):
df=pd.read_json(session["df"])

#CALL FIGURE FUNCTION
# try:
fig=make_figure(df,plot_arguments)
try:
fig=make_figure(df,plot_arguments)

#TRANSFORM FIGURE TO BYTES AND BASE64 STRING
figfile = io.BytesIO()
plt.savefig(figfile, format='png')
plt.close()
figfile.seek(0) # rewind to beginning of file
figure_url = base64.b64encode(figfile.getvalue()).decode('utf-8')
#TRANSFORM FIGURE TO BYTES AND BASE64 STRING
figfile = io.BytesIO()
plt.savefig(figfile, format='png')
plt.close()
figfile.seek(0) # rewind to beginning of file
figure_url = base64.b64encode(figfile.getvalue()).decode('utf-8')

return render_template('/apps/scatterplot.html', figure_url=figure_url, filename=filename, apps=apps, **plot_arguments)
return render_template('/apps/scatterplot.html', figure_url=figure_url, filename=filename, apps=apps, **plot_arguments)

# except Exception as e:
# flash(e,'error')
# return render_template('/apps/scatterplot.html', filename=filename, apps=apps, **plot_arguments)
except Exception as e:
flash(e,'error')
return render_template('/apps/scatterplot.html', filename=filename, apps=apps, **plot_arguments)

else:
if download == "download":
Expand Down

0 comments on commit ff00e0e

Please sign in to comment.