Repository navigation
Windows: LocalStorage file:// URLs with an empty path - #56
Merged
Merged
Conversation
get_storage_url returned f"file://{path}", which on Windows is
file://C:\..., parsed as host 'C:\...' with an empty path, so pandas (and
ods_tools through it) failed with URLError (WinError 3). The path is now made
absolute and written in posix form after a leading '/': file:///C:/... on
Windows, file:///abs/path unchanged on POSIX (a relative root_dir no longer
gives the host-only file://rel/path). The pyarrow reader turns the URL back
into a path with the matching file_url_to_path.
Part of OasisLMF/OasisLMF#2305
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sambles
approved these changes
Nov 19, 2026
Open
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.
Part of OasisLMF/OasisLMF#2305
LocalStorage.get_storage_urlreturnedf"file://{Path(root_dir, filename)}". On Windows that isfile://C:\...:C:\...is parsed as the URL's host and the path is empty, so reading an OED file given as a string (pandasread_csvthrough ods_tools) fails withURLError(WinError 3).Changes
path_to_file_url: the path is made absolute and written in posix form after a leading/, givingfile:///C:/...on Windows. POSIX absolute paths give exactly the same URL as before (file:///abs/path). A relativeroot_dir(the default"") used to givefile://rel/path, whererelis the host; it now gives the absolute URL. No percent-encoding, as before.file_url_to_path: the inverse, used by the pyarrow reader instead ofuri.replace('file://', ''), which would have left/C:/...on Windows.Tests
tests/filestorage/test_local.py: Windows path to URL and back (checked withnturl2path), POSIX URL unchanged, and aLocalStorageURL with and withoutroot_dirread bypd.read_csv.pytest tests/filestorage/test_local.py tests/df_reader --ignore=tests/df_reader/test_geo.py: 38 passed, 9 skipped (33 in df_reader, unchanged from main; 5 in test_local.py, 3 of them new).test_geo.pycannot be collected here (no dask), unrelated.OasisLMF also stops sending local OED files to ods_tools as strings, so it no longer depends on this fix.
🤖 Generated with Claude Code