I want to create a chatbot that is trained through inputs

Question:
I want to create a chatbot that is trained through inputs and I want it to make it so that replit db syncs with everyone. But I just can’t do anything… it keeps giving me errors.

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    from idkwhttph import db
  File "/home/runner/QuickScaryGlitch/venv/lib/python3.10/site-packages/replit/__init__.py", line 5, in <module>
    from . import web
  File "/home/runner/QuickScaryGlitch/venv/lib/python3.10/site-packages/replit/web/__init__.py", line 9, in <module>
    from .app import ReplitApp
  File "/home/runner/QuickScaryGlitch/venv/lib/python3.10/site-packages/replit/web/app.py", line 90, in <module>
    class JSONEncoder(flask.json.JSONEncoder):
AttributeError: module 'flask.json' has no attribute 'JSONEncoder'

Repl link:
https://replit.com/@Idkwhttph/QuickScaryGlitch?v=1

from idkwhttph import db
from idkwhttph import *
from time import sleep
import os
os.environ['REPLIT_DB_URL'] = "https://replit-database-proxy.idkwhttph.repl.co"

Yeah, Replit web has been giving this error for a while, now. I just guessed that Flask updated its JSON encoder. Anyway, just don’t use web.run.

1 Like

Well, then what are the alternatives? Or the fast alternative ways that I can turn to? I want to sync the data with everyone… But I can’t seem to do anything to the code without solving the error. Sorry for the inconvenience caused! ( or if there is any :rofl: )

What?

You know how to normally run a Flask app, right?

app.run

1 Like

Yes.

I don’t use that. Or maybe what is causing all this trouble is that my db in my package is modified. Let me try.

I’ve been able to import replit.web just fine without calling web.run. Maybe something in your package calls web.run.


:scream:
I didn’t even throw any of the main code in, and then this happens.
Okay maybe its the exact same error… But this time the error is pointing at
from replit import db

Oh, right. Replit DB uses the JSONEncoder, so it’s not just replit.web. Well Idk why replit works for me :woman_shrugging:

2 Likes

Fixed it! I made modifications to the db again and boom its done! Sorry for the inconvenience caused! Thank you everyone!
the chatbot is here: Go and train the chatbot!