# HG changeset patch # User drewp@bigasterisk.com # Date 2014-06-15 18:04:55 # Node ID 92ffad96fd8a0570b5df8438b21df7be6bbf3b07 # Parent 102a456be7db7a458a73b7f13b26a86820a309b4 more error detail on bad expressions Ignore-this: 684cbe10927c70152bd280e3982028d8 diff --git a/bin/effecteval b/bin/effecteval --- a/bin/effecteval +++ b/bin/effecteval @@ -53,6 +53,7 @@ def newEnvelopeCurve(graph, ctx, uri, la @inlineCallbacks def insertEnvelopePoints(curve): + # wrong: we might not be adding to the currently-playing song. musicStatus = yield getMusicStatus() songTime=musicStatus['t'] songDuration=musicStatus['duration'] diff --git a/light9/effecteval/effect.py b/light9/effecteval/effect.py --- a/light9/effecteval/effect.py +++ b/light9/effecteval/effect.py @@ -133,7 +133,11 @@ class EffectNode(object): for c in self.codes: codeNs = ns.copy() codeNs.update(c.pyResources) - lineOut = eval(c.expr, codeNs) + try: + lineOut = eval(c.expr, codeNs) + except Exception as e: + e.expr = c.expr + raise e ns[c.outName] = lineOut if 'out' not in ns: log.error("ran code for %s, didn't make an 'out' value", self.uri) diff --git a/light9/effecteval/effectloop.py b/light9/effecteval/effectloop.py --- a/light9/effecteval/effectloop.py +++ b/light9/effecteval/effectloop.py @@ -147,6 +147,8 @@ class EffectLoop(object): except Exception as exc: now = time.time() if now > self.lastErrorLog + 5: + if hasattr(exc, 'expr'): + log.error('in expression %r', exc.expr) log.error("effect %s: %s" % (e.uri, exc)) self.lastErrorLog = now log.debug('eval %s effects, got %s outputs', len(self.currentEffects), len(outputs))