Repository navigation
fix(core): pass str paths to fsspec in SimpleDirectoryReader - #23664
Open
muthukkumaranb wants to merge 1 commit into
Open
muthukkumaranb wants to merge 1 commit into
muthukkumaranb wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
SimpleDirectoryReaderpassesPath/PurePosixPathobjects directly tofs.open(). Most fsspecfilesystems accept these, but
DirFileSystem._join()only handlesstr,listanddict, so it triesto iterate the path and fails with
TypeError: 'PurePosixPath' object is not iterable.This PR converts the path to
strat the threefs.open()call sites (read_file_content,load_file,aload_file). Other filesystems are unaffected because they already accept plain strings.Fixes #23663
New Package?
Version Bump?
Type of Change
How Has This Been Tested?
Added a
dir_fsfixture (aMemoryFileSystemwrapped in aDirFileSystem) and three tests coveringload_data,aload_dataandread_file_content. All three failed before the fix with theTypeErrorand pass after it.
uv run -- pytest tests/readersin llama-index-core: 34 passed.ruff format --checkandruff checkpass on the changed files.Suggested Checklist:
AI disclosure: I used an AI assistant (Claude) to help locate the call sites and draft the
regression tests. I reproduced the bug myself, reviewed every line, and ran the tests listed above.