From ea02a4e348d2c4841c2dd681e8401aa48ccc65ba Mon Sep 17 00:00:00 2001 From: "Josh Warner (Mac)" Date: Sat, 28 Feb 2015 13:16:56 -0600 Subject: [PATCH] FIX: Ignore exception if attempted deletion fails (fixes #817) --- skimage/measure/_find_contours.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/skimage/measure/_find_contours.py b/skimage/measure/_find_contours.py index ff53795f..3e45f2cd 100755 --- a/skimage/measure/_find_contours.py +++ b/skimage/measure/_find_contours.py @@ -167,7 +167,10 @@ def _assemble_contours(points_iterator): head.extend(tail) # remove all traces of tail: del starts[to_point] - del ends[tail[-1]] + try: + del ends[tail[-1]] + except KeyError: + pass del contours[tail_num] # remove the old end of head and add the new end. del ends[from_point]