Find answers from the community

Updated 2 months ago

Loader error

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.dict)
File "/Users/autony053/Desktop/Python/test.py", line 49, in <module>
documents = loader.load_data()
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/llama_index/readers/llamahub_modules/file/base.py", line 142, in load_data
extracted_documents = reader.load_data(
^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/llama_index/readers/llamahub_modules/file/json/base.py", line 72, in load_data
return [Document("\n".join(useful_lines), extra_info=extra_info)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pydantic/main.py", line 332, in pydantic.main.BaseModel.init
TypeError: init() takes exactly 1 positional argument (2 given)

hello, can someone help me resolve this πŸ™
L
A
5 comments
Did you use download loader? You might need to refresh the cache to get the latest code

download_loader(..., refresh_cache=True)
Plain Text
SimpleDirectoryReader = download_loader("SimpleDirectoryReader", refresh_cache=True)
loader = SimpleDirectoryReader(doc_path, recursive=True, exclude_hidden=True)
documents = loader.load_data()
that did not work unfortunately 😦
weird that it didn't work πŸ€” The code in the repo is updated/fixed

But anyways, simple directory reader is also built into llama-index, no need to download it

Plain Text
from llama_index import SimpleDirectoryReader
thank you for your help πŸ™
i really do appreciate it
Add a reply
Sign up and join the conversation on Discord