From 92f288e8b33a67060a4553d8e71d618038885bf9 Mon Sep 17 00:00:00 2001 From: Tomas Musil Date: Tue, 1 Jul 2014 21:50:50 +0200 Subject: [PATCH 1/1] fix more errors --- src/gridf2.py | 5 ++++- src/intrsc.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gridf2.py b/src/gridf2.py index 4f276fd..8e6936a 100644 --- a/src/gridf2.py +++ b/src/gridf2.py @@ -32,7 +32,10 @@ def nearest2(lines, point): def generate_models(sgrid, lh): for f in [0, 1, 2, 3, 5, 7, 8, 11, 15, 17]: - grid = gm.fill(sgrid[0], sgrid[1], lh , f) + try: + grid = gm.fill(sgrid[0], sgrid[1], lh , f) + except ZeroDivisionError: + continue grid = [sgrid[0]] + grid + [sgrid[1]] for s in xrange(17 - f): grid = [gm.expand_left(grid, lh)] + grid diff --git a/src/intrsc.py b/src/intrsc.py index 6f78f8d..a740212 100644 --- a/src/intrsc.py +++ b/src/intrsc.py @@ -163,7 +163,7 @@ def stone_color_raw(image, (x, y)): pass norm = float(len(points)) if norm == 0: - return 0, 0, 0 #TODO trow exception here + return 0, 0, (0, 0, 0) #TODO trow exception here color = (sum(p[0] for p in points) / norm, sum(p[1] for p in points) / norm, sum(p[2] for p in points) / norm) -- 2.4.2