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 downloading remote datasets to cache on Windows #655

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Nov 3, 2023

Description of the change

Fixes #654 reported by @ericpre.

We use Pooch to manage our kikuchipy.data module. Pooch requires file paths with unix-style separators "/" only. However, os.path.join(), which returns paths with "\"-separators on Windows, was used to create paths passed to Pooch in one place in our data module. Thus the reported error.

This PR should fix this issue by using pathlib.Path to create paths for Pooch.

I tested that it works on a local Windows machine. This issue was not caught by our test suite because it is too computationally expensive to download a file from Zenodo in a test. I'm not sure how to make a computationally inexpensive test that would catch this without calling internal methods in Pooch.

Progress of the PR

Minimal example of the bug fix or new feature

The following works on Windows:

>>> import kikuchipy as kp
>>> s = kp.data.si_wafer(allow_download=True)

For reviewers

  • The PR title is short, concise, and will make sense 1 year later.
  • New functions are imported in corresponding __init__.py.
  • New features, API changes, and deprecations are mentioned in the unreleased
    section in CHANGELOG.rst.
  • New contributors are added to release.py, .zenodo.json and
    .all-contributorsrc with the table regenerated.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes added the bug Something isn't working label Nov 3, 2023
@hakonanes hakonanes added this to the v0.9.0 milestone Nov 3, 2023
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes merged commit bde4cd0 into pyxem:develop Nov 3, 2023
12 checks passed
@hakonanes hakonanes deleted the fix-654 branch November 3, 2023 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with kikuchipy.data.si_wafer
1 participant