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 io.imread behavior with pathlib.Path inputs #5546

Merged
merged 3 commits into from
Sep 1, 2021

Conversation

grlee77
Copy link
Contributor

@grlee77 grlee77 commented Aug 27, 2021

Description

closes #5545

The following logic for using tifffile fails if fname is a Path:

    if plugin is None and hasattr(fname, 'lower'):
        if fname.lower().endswith(('.tiff', '.tif')):
            plugin = 'tifffile'

Casting the Path to str before this if statement resolves the issue.

Checklist

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

Need to convert Path object to str so the check for .tiff/.tif extension used
to set plugin = 'tifffile' will work
@grlee77 grlee77 added the 🩹 type: Bug fix Fixes unexpected or incorrect behavior label Aug 27, 2021
@pep8speaks
Copy link

pep8speaks commented Aug 27, 2021

Hello @grlee77! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-08-27 20:40:36 UTC

Copy link
Member

@soupault soupault left a comment

Choose a reason for hiding this comment

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

Thank you @grlee77 !
Based on the adoption of Path among the ecosystem, it still seems early to switch from str.

@grlee77 grlee77 added this to the 0.19 milestone Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🩹 type: Bug fix Fixes unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

imread() for tiff file returns wrong dimensions
4 participants