Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Open
Description
Feature or enhancement
Proposal:
Given that ZipPath doesn't provide awrite_text
orwrite_bytes
, I'm trying to useZipFile.writestr
and noticed that when the data you're trying to write isn't the right type it still stores an empty entry. I didn't expect side effects when it failed this fundamentally to get the data.
importzipfilewithzipfile.ZipFile("foo.zip","w")asz:z.writestr("x", ())print(z.namelist())# -> "x"
Notably, Path.write_text behaves the way I'd expect -- it has to construct a memoryview successfully first before opening the file.
frompathlibimportPathPath("x").write_bytes(())# -> neither creates nor truncates
@jaraco I assume ZipPath not supporting writes is intentional?
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Metadata
Metadata
Assignees
Projects
Status
No status