Fix Windows path resolution for normalization_path#81
Open
AnnihilatorChess wants to merge 1 commit intoPolymathicAI:masterfrom
Open
Fix Windows path resolution for normalization_path#81AnnihilatorChess wants to merge 1 commit intoPolymathicAI:masterfrom
AnnihilatorChess wants to merge 1 commit intoPolymathicAI:masterfrom
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.
Summary
The normalization path refactor introduced in #69 breaks on Windows due to a platform-specific path separator issue.
.lstrip("./")on this line only strips Unix-style separators (.and/). On Windows,os.path.joinproduces backslash-separated paths, so.removeprefix(trunk_path)leaves a leading\(e.g.\stats.yaml), which.lstrip("./")does not strip. When this is passed toos.path.join, Windows interprets the leading\as a drive-root path, resolving toC:\stats.yamlinstead of the correct dataset-relative path.Fix
Adding
\to the lstrip characters:.lstrip("./\\")— this has no effect on macOS/Linux since backslashes don't appear in paths there.Steps to reproduce
well_base_pathas a relative path (e.g.../../datasets/)use_normalization=Truenormalization_pathincorrectly resolves toC:\stats.yaml