From 18bb3f539243128c1dd47ccf40a6ca966e5e555d Mon Sep 17 00:00:00 2001 From: jim Date: Wed, 3 Jun 2015 14:58:42 -0500 Subject: [PATCH] resolves #54: raises Index error when you go out of bounds --- nd2reader/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nd2reader/__init__.py b/nd2reader/__init__.py index f3f5d7b..979f5ec 100644 --- a/nd2reader/__init__.py +++ b/nd2reader/__init__.py @@ -61,6 +61,8 @@ class Nd2(Nd2Parser): image = Image(timestamp, raw_image_data, fov, channel, z_level, self.height, self.width) except (TypeError, ValueError): return None + except KeyError: + raise IndexError("Invalid frame number.") else: return image elif isinstance(item, slice):