# HG changeset patch # User drewp@bigasterisk.com # Date 1402789307 0 # Node ID dc86936969d8e266592f22427848329478c66c84 # Parent f66586649ae33376f181c97c3fb6911c25a2852c SC don't break so much on corrupt subs (but we don't yet remove their dangling graph links) Ignore-this: 21e85113aa81d0026080c3e01ee848db diff -r f66586649ae3 -r dc86936969d8 light9/dmxchanedit.py --- a/light9/dmxchanedit.py Sat Jun 14 23:41:25 2014 +0000 +++ b/light9/dmxchanedit.py Sat Jun 14 23:41:47 2014 +0000 @@ -19,10 +19,10 @@ from __future__ import nested_scopes,division import Tkinter as tk from rdflib import RDF, Literal -import math +import math, logging from decimal import Decimal from light9.namespaces import L9 - +log = logging.getLogger('dmxchanedit') stdfont = ('Arial', 9) def gradient(lev, low=(80,80,180), high=(255,55,50)): @@ -192,12 +192,20 @@ remaining = set(self.levelFromUri.keys()) for ll in self.graph.objects(sub, L9['lightLevel']): chan = self.graph.value(ll, L9['channel']) - lev = self.graph.value(ll, L9['level']).toPython() + try: + lev = self.graph.value(ll, L9['level']).toPython() + except AttributeError as e: + log.error('on lightlevel %r:', ll) + log.exception(e) + continue if isinstance(lev, Decimal): lev = float(lev) assert isinstance(lev, (int, long, float)), repr(lev) - self.levelFromUri[chan].setTo(lev) - remaining.remove(chan) + try: + self.levelFromUri[chan].setTo(lev) + remaining.remove(chan) + except KeyError as e: + log.exception(e) for channel in remaining: self.levelFromUri[channel].setTo(0)