I have a python repl and something appears to have happened overnight and now it cannot import any libraries
i get this error
Traceback (most recent call last):
File “main.py”, line 1, in
from keep_alive import keep_alive
File “/home/runner/Wenlaunch-Bot/keep_alive.py”, line 1, in
from flask import Flask,render_template
ImportError: cannot import name ‘Flask’ from ‘flask’ (/home/runner/Wenlaunch-Bot/venv/lib/python3.8/site-packages/flask/init.py)
This is happening because the file for the init of flask (and I’d assume the rest of the folder, or even many user installed packages), have been corrupted, not in a way to say completely and utterly maliciously changed or turned to gibberish, but to say that while it is still valid python code, I’d say it’s probably empty. This may be caused by the fact that flask is a pre-installed python module, and therefore problems come from testing of python repls or something. Just try uninstalling and reinstalling flask by:
package manager press - on the flask entry then search flask and press + on the first entry
open shell and run pip uninstall flask -y && pip install flask or if the previous command doesn’t work, try pip uninstall flask -y; pip install flask to install and uninstall flask
open shell and enter the command pip install --upgrade flask to upgrade your flask version
try poetry remove flask; poetry add flask. Worst come to worst, copy all files manually to another repl (this will solve the file corruption problem, make sure you do not fork, as that will copy the corrupted package files)
it is “possible” to install it with sudo on a linux environment, but I have never been able to get this to work on replit
because, funnily enough, replit does not have sudo installed, and nix evades my understanding to no end (you have to install it via nix – nix just baffles me and I have no idea how to use it).
Finally, installing sudo is not very difficult, but bypassing replit flag securities would be a real headache:
copied files to new repl and it seems fine, but the replit database is empty… anyway to clone that from a repl that wont boot… i can access from shell but only one key at a time
EDIT: I see you cannot enter the shell, that complicates things, I apologize as I do not know how to fix this, perhaps try rebuilding your db or just saying you had a server wipe to all users