user1070036 user1070036 - 1 year ago 219
Python Question

Python flask flash message exception remains after restarting

I'm making a small flask app where I had something like this:

def logout():
session.pop('logged_in', None)
return redirect('/index')

Needless to say when I ran the application and I navigated to '/bye' it gave me a UnicodeDecodeError. Well, now it gives me the same unicodedecodeerror on every page that extends the base template (which renders the messages) even after restarting the application. and always with the same dump() despite removing that flash in the source code. All I can think of is what the crap? Help please.

Well I had to restart my computer to clear the stupid session cache or something.

Answer Source

I think that flash() actually creates a session called session['_flashes']. See this code here. So you will probably have to either:

clear/delete the cookie 


session.pop('_flashes', None)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download