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 problem with ZIP paths on Windows. #182

Merged
merged 2 commits into from
Dec 31, 2023
Merged

Fix problem with ZIP paths on Windows. #182

merged 2 commits into from
Dec 31, 2023

Conversation

sobolevnrm
Copy link
Collaborator

Fixes #181.

Copy link

codecov bot commented Dec 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5a00d05) 74.82% compared to head (8659f03) 74.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #182      +/-   ##
==========================================
+ Coverage   74.82%   74.84%   +0.01%     
==========================================
  Files          25       25              
  Lines        4116     4118       +2     
==========================================
+ Hits         3080     3082       +2     
  Misses       1036     1036              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@speleo3
Copy link
Collaborator

speleo3 commented Dec 30, 2023

Thanks for the fix!
There is a method for getting the string with forward slashes: Path.as_posix()
Result should be the same, but maybe looks a bit cleaner?

https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.as_posix

Replace `str.join` with `Path.as_posix`.
@sobolevnrm
Copy link
Collaborator Author

@speleo3 can you please review again with this change?

continue
zf = zipfile.ZipFile(p)
stream = zf.open(str(input_file.relative_to(p)))
path_string = Path.as_posix(input_file.relative_to(p))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as input_file.relative_to(p).as_posix()

@sobolevnrm sobolevnrm merged commit af0fd55 into master Dec 31, 2023
14 checks passed
@sobolevnrm sobolevnrm deleted the nathan/181 branch December 31, 2023 03:08
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.

test_open_file_for_reading fails on Windows
2 participants