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

Monkey-patch os.path to support gs:// URIs #273

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

janEbert
Copy link

This monkey-patches the private os.path._get_sep function used by os.path.join to handle paths that start with "gs://". If a path starts with "gs://", we ignore the OS separator and return "/" as the separator to use.

Background info

For example in the pretrained_optimizers.py file, os.path.join is used to concat strings for the gs:// URIs (one example).
This will cause issues on Windows machines because there, URIs are concatenated with "".

Since I understand monkey-patching is always quite fickle, I can also replace all os.path.join usages with a new method that uses '/'.join(paths) for "gs://" paths instead.

This monkey-patches the private `os.path._get_sep` function used by
`os.path.join` to handle paths that start with "gs://". If a path starts
with "gs://", we ignore the OS separator and return "/" as the separator
to use.
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.

1 participant