I copied a code from a Jupyter notebook in py files but it is not running. What could be the problem?
Could we see your code/have the repl link please?
The repl is private so we cannot see it.
Can you make it public?
Hi, your program works. Just its really slow because it has to request to so many links.
print("started") in the first line to check whether replit runs it. Thats why its in output)
How do you run it? Through the shell?
I just saw
createindex.py file. So in line 24
loader was not defined in the file. It was defined in
main.py. You cannot use variables from another file.
Im assuming you need to run
So what you could do is put the code that you need to run in
createindex.py as a function and then import and run the function in
main.py after the
loader variable is set.
For example you have 2 files:
#main.py print("hello") name = input("name?: ") # this name variable defined here needs to be used in welcomer.py. Similar to your problem: `loader` defined in main.py needs to be used in `createindex.py`
#welcomer.py import random print("Welcome", name, random.randint(5)) #name not defined in this file. Instead it is on main.py
So you have to make code in
welcomer.py as a function. (In your case
createindex.py needs to have that function)
#main.py from welcomer import welcome #import function from file print("hello") name = input("name?: ") welcome(name) #now it has access to the name variable.
#welcomer.py import random #note that import statements are not in the function. It could be but this way is better def welcome(name): #variable as function parameter print("Welcome", name, random.randint(5))
That is because run button by default runs
Read my answer above to be able to run your code properly
Also sidenote: you can reduce the list of websites to 10 just for testing and after everything works add it back. This will speed things up immensely.
Also if you dont understand the post above, i could provide the code and you can read and understand it
Can you send a screenshot
Sadly installing that package for me seems to not be possible because the package is too big(>1gb)
It might be possible that it works for you as you are a paid user of replit, so your repls would have double the storage a free user has(like me)
- Open the shell
pip uninstall replit(this is the outdated package causing problems. You dont use it in code so its safe to remove)
- Go to
pyproject.tomland remove the line
replit>=xxx(the line that has replit)
- Again go to shell and do
poetry add chromadb
This will take a reallly long time as the package is too big. After running, you can inform me what you get.
Here is what i get (cant install cuz storage is low for free user:
For installing gradio:
- Go to shell
pip install filelock(poetry needs this package. So install it)
poetry add gradio(actually installs gradio)
Can you try doing
pip install --upgrade typing-extensions
!pip install --upgrade typing-extensions
(Im not sure whether the ‘!’ Should exist or not)
Can you select any of my posts as “solved” whichever helped the most
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.