Experimentally passing the pathlib.Path to zipfile.ZipFile fails on at
least some Python versions. I've gotten frustrated enough I'd rather
just force them to be strings and move on.
Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG69b4426d288b: packaging: coerce paths to strings
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Comment Actions
Eh? I don't see anything wrong with this. Casting a pathlib.Path to str should just work! In fact, it is necessary for older Python 3, as there was a long tail of stdlib functions that didn't accept pathlib.* when those types were first introduced. I believe 3.7 was the first release that fixed them all.
Comment Actions
At least one of the archive libraries can't cope with a destination being a Path but a source being a str, or something like that. zipfile can't (AFAICT) cope with Path objects on Python 3.5, but I worked around that by finding a Windows image at work that came with 3.7 already installed. :)