Forums

Getting Error running WSGI application 2023-09-22 18:57:09,981: AttributeError: 'NoneType' object has no attribute 'replace'

Hi, I'm new to coding and development. I'm getting this error when trying to run a flask web app on python anywhere where I have used "replace" in app.py:

Error running WSGI application 2023-09-22 18:57:09,981: AttributeError: 'NoneType' object has no attribute 'replace'

Can you please help ?

Somewhere in your code your calling .replace on a variable which isn't assigned any value eg

string_variable = 'some string'
string_variable.replace('some', 'another')  # This is fine because the variable is a string

string_variable = None
string_variable.replace('some', 'another'). # This will throw the error that youre seeing