Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix path normalization on Windows #375

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Richienb
Copy link

@Richienb Richienb commented Oct 5, 2023

os.path.abspath uses forward slashes on posix and back slashes on Windows.
This is a problem because the next line of code splits the string by (only) forward slashes.
Instead, we can use posixpath.normpath which always uses forward slashes.

@Richienb Richienb changed the title Fix normalization on Windows Fix path normalization on Windows Oct 5, 2023
Copy link
Collaborator

@Lucaweihs Lucaweihs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Richienb, in principle I am happy to make a change like this, though I think we'd need to do something like:

rel_base_dir = posixpath.normpath(os.path.relpath(os.path.abspath(args.experiment_base), os.getcwd()))

to retain the same behavior of ensuring the path is relative the current working directory. Before making this change though: this change suggests that you're trying to get allenact working with Windows. Have you successfully done so? This isn't a use case we officially support (as most development is done on Mac/Linux) but I'd be interested in hearing otherwise.

@Richienb
Copy link
Author

I have not yet succeeding in running allenact on Windows, this pr contains a change I made which fixes an error that was thrown, though there are likely more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants