-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
write_image() doesn't work with pathlib.Path() objects #2753
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
Comments
Thanks for the bug report and the attempted PR :) I wonder if there's not a more generic solution than spot-checking for |
@nicolaskruchten, any chance of getting a review on my #2974 PR? Thanks! |
Thanks @dtoniolo for the support and the suggestion, I was unaware of The huge disadvantage I see with the I would really like |
@dtoniolo your comment inspired me to add a test case for (Just to be clear, there aren't many cases where it's desirable to use |
I wasn't aware of these technicalities, thank you for sharing them. Then your solution definitely covers the broadest range possible. I hope it gets accepted soon |
I landed here because I observed the same issue with |
@pascal456 thanks for the report! That's really useful to know because I should build a test case for that. |
Support for this just came out with version 5.0 :) |
This code works as expected:
However, if you try to use a pathlib.Path object instead of a string, you get an exception:
This code works, though:
So, at a minimum this could be fixed by checking if
file
is an instance of pathlib.Path and if so, cast it as a str.PS Thanks for all the hard work on this project, it's great watching it continually improve. This isn't a particularly important issue for me, just wanted to add it to the list of potential fixes for the next version in case others are also interested.
The text was updated successfully, but these errors were encountered: