From e1ba34be015ad6bd17a4f3613581e1bb3c24adbb Mon Sep 17 00:00:00 2001 From: Karol Gotkowski Date: Wed, 20 Mar 2024 11:52:49 +0100 Subject: [PATCH] fix: handle Path objects correctly when checking store (#1) --- mzarr/mzarr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mzarr/mzarr.py b/mzarr/mzarr.py index 8533bd6..990b9e3 100644 --- a/mzarr/mzarr.py +++ b/mzarr/mzarr.py @@ -6,6 +6,7 @@ from typing import Optional, List, Union, Literal, Any import os import numcodecs +from pathlib import Path numcodecs.register_codec(JpegXl) @@ -32,7 +33,7 @@ def __init__(self, store: Union[np.ndarray, str], mode: Literal['r', 'r+', 'a', self.store = None self.array = None - if isinstance(store, str): + if isinstance(store, str) or isinstance(store, Path): self.load(store, mode) else: if store.dtype in [np.uint8, np.uint16, np.float16, np.float32]: