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

A fresh ZipStore cannot be opened with mode r #2450

Open
d-v-b opened this issue Oct 30, 2024 · 2 comments
Open

A fresh ZipStore cannot be opened with mode r #2450

d-v-b opened this issue Oct 30, 2024 · 2 comments

Comments

@d-v-b
Copy link
Contributor

d-v-b commented Oct 30, 2024

You cannot open a non-existent ZipStore in r mode, because zipfile.ZipFile.__init__ will fail to find the zip file on disk and raise an exception. This is obvious given how files work, but surprising in the context of the other Store classes, which can all be opened in r mode without any IO (I think).

@jhamman
Copy link
Member

jhamman commented Oct 30, 2024

The existing behavior feels like a good place to be but I'm curious if you think we should delay alerting the user when their store does not exist? What sort of behavior are do you think makes sense?

@d-v-b
Copy link
Contributor Author

d-v-b commented Oct 30, 2024

Other than raising an exception on init (the status quo), the only other option would be to create an empty zip file, which will contain nothing and therefore be rather useless as long as the mode is 'r'. I don't know which of these two is more natural for users.

If we keep the status quo, we should probably at least handle the FileNotFoundError raised from ZipFile and include some information about how you have to first create the zip file before it can be opened in r mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants