2929
3030from numpy .exceptions import ComplexWarning
3131
32+ from . import exceptions
33+
3234if TYPE_CHECKING :
3335 from collections .abc import Callable , Sequence
3436
@@ -3294,14 +3296,16 @@ def _open_lazyarray(array):
32943296 operands = lazyarray ["operands" ]
32953297 parent_path = Path (array .schunk .urlpath ).parent
32963298 operands_dict = {}
3299+ missing_ops = {}
32973300 for key , value in operands .items ():
32983301 if isinstance (value , str ):
32993302 value = parent_path / value
33003303 try :
33013304 op = blosc2 .open (value )
33023305 except FileNotFoundError :
3303- op = None
3304- operands_dict [key ] = op
3306+ missing_ops [key ] = value
3307+ else :
3308+ operands_dict [key ] = op
33053309 elif isinstance (value , dict ):
33063310 # C2Array
33073311 operands_dict [key ] = blosc2 .C2Array (
@@ -3312,16 +3316,17 @@ def _open_lazyarray(array):
33123316 raise TypeError ("Error when retrieving the operands" )
33133317
33143318 expr = lazyarray ["expression" ]
3315- try :
3316- new_expr = LazyExpr ._new_expr (expr , operands_dict , guess = True , out = None , where = None )
3317- # Make the array info available for the user (only available when opened from disk)
3318- new_expr .array = array
3319- # We want to expose schunk too, so that .info() can be used on the LazyArray
3320- new_expr .schunk = array .schunk
3321- except RuntimeError :
3322- # Something unexpected happened. Avoid guessing and return something that
3323- # can be introspected.
3324- new_expr = LazyExpr ._new_expr (expr , operands_dict , guess = False , out = None , where = None )
3319+ if missing_ops :
3320+ exc = exceptions .MissingOperands (expr , missing_ops )
3321+ exc .expr = expr
3322+ exc .missing_ops = missing_ops
3323+ raise exc
3324+
3325+ new_expr = LazyExpr ._new_expr (expr , operands_dict , guess = True , out = None , where = None )
3326+ # Make the array info available for the user (only available when opened from disk)
3327+ new_expr .array = array
3328+ # We want to expose schunk too, so that .info() can be used on the LazyArray
3329+ new_expr .schunk = array .schunk
33253330 return new_expr
33263331
33273332
0 commit comments