Question:
By importing the replit database in python, the code will never stop running. Repl link/Link to where the bug appears:
Just get a python repl and import db and then do something with the database Screenshots, links, or other helpful context:
from replit import db
db["hello"]="hello"
print(db["hello"])
quit()
If you do something with the database (e.g. set a key) the code keep running forever, no matter what happens.
The issue here is not actually using the DB, but rather that you are using quit(). It usually has a lot of issues with Replit. So simply remove the quit() line and it should work fine.
But an important thing to note is that the Packager output reveals there is a package conflict between flask (which comes pre-installed at ^3.0.0) and replit. This means that it didn’t actually install the replit package correctly, or that there may be errors from replit’s dependencies.
Looking at the repl and reproducing, it seems that replit package is indeed installed, but the package manager poetry doesn’t realize.
Since the flask version is incompatible with the replit version (as replit depends on a lower version of flask), the replit database will not work. (It just happens that replit has been installed, when it shouldn’t, so you don’t get a ModuleNotFoundError.)
There are many topics about the replit - flask incompatibility, you could search for it on this forum.
well I got the code to end but it’s not exactly what you were looking for because I removed virtually everything including the database import meaning it is pretty much a basic print command
That’s strange. Does it run forever if you do python main.py in the Shell?
Refer to my previous post for the most probable reason why this is happening (package conflicts). If you fix the package conflicts, the problem will probably not occur.
You could also try exiting forcefully at the end, with an exception or sys.exit().