My flask app was working prior to upgrades. I was having trouble with sending email when there was a forgot-reset-password. To try and fix this I recently upgraded some modules for my flask app. The modules that I upgraded with current versions are:
The Traceback error that I am getting now is:
Traceback (most recent call last):
File "C:\Users\my_folder\sales\app.py", line 1, in <module>
from product import app
File "C:\Users\my_folder\sales\product\__init__.py", line 56, in <module>
from product.agents.views import agents_bp
File "C:\Users\my_folder\sales\product\agents\views.py", line 7, in <module>
from product.agents.forms import RegistrationForm, LoginForm, UpdateAccountForm, ResetPasswordForm, RequestResetForm
File "C:\Users\my_folder\sales\product\agents\forms.py", line 1, in <module>
from flask_wtf import FlaskForm
File "C:\Users\my_folder\flask_env\lib\site-packages\flask_wtf\__init__.py", line 4, in <module>
from .recaptcha import Recaptcha
File "C:\Users\my_folder\flask_env\lib\site-packages\flask_wtf\recaptcha\__init__.py", line 1, in <module>
from .fields import RecaptchaField
File "C:\Users\my_folder\flask_env\lib\site-packages\flask_wtf\recaptcha\fields.py", line 3, in <module>
from . import widgets
File "C:\Users\my_folder\flask_env\lib\site-packages\flask_wtf\recaptcha\widgets.py", line 6, in <module>
JSONEncoder = json.JSONEncoder
AttributeError: module 'flask.json' has no attribute 'JSONEncoder'
How do I go about fixing this?
Python has had a builtin JSONEncoder since at least 3.2, making Flask's version redundant. So it's reasonable to remove it.
If this was a module you controlled, you could just replace your line JSONEncoder = json.JSONEncoder
with
from json import JSONEncoder
Since you don't control this library though, you should notice which library that is trying to include it, in your case that's flask_wtf
. When you check PyPi for that library you'll see that there's a few recent releases, suggesting the first thing you should try is updating that version on Flask-WTF.