Skip to content

AttributeError: 'ZipStore' object has no attribute '_lock' #3588

Closed

Description

@oelhammouchi

Zarr version

v3.1.3

Numcodecs version

v0.16.3

Python Version

3.12.10

Operating System

Linux

Installation

using uv

Description

Calling the exists method on a ZipStore instance for an existing ZIP file raises the exception AttributeError: 'ZipStore' object has no attribute '_lock'. It seems this is because the method is not protected by a block

 if not self._is_open:
    self._sync_open()

as seen elsewhere in the code. If this was simply an omission it should be an easy fix, I can open a PR if you want.

Thanks a lot for the great library!

Steps to reproduce

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
# ]
# ///
#
# This script automatically imports the development branch of zarr to check for issues

from zarr.storage import ZipStore
from zipfile import ZipFile
import asyncio

ZipFile("/tmp/tmp.zip", "w").close()

async def main():
    with ZipStore("/tmp/tmp.zip", mode="r") as store:
        return await store.exists("somekey")

asyncio.run(main())

Additional output

No response

Activity

  1. added
    bugPotential issues with the zarr-python library
    on Nov 20, 2025
  2. d-v-b commented on Nov 20, 2025

    @d-v-b
    Contributor

    sorry about this, and a PR fixing it would be great

  3. oelhammouchi commented on Nov 21, 2025

    @oelhammouchi
    ContributorAuthor
  4. added a commit that references this issue on Mar 26, 2026
    d4409e8
  5. d-v-b commented on Oct 27, 2026

    @d-v-b
    Contributor

    closed by #4450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions