def predRetractall(agent, bindings, expr): imp = bindings.bImp(agent, expr) try: return imp.retractall(agent, bindings, expr) except NotLocatedError: errid = NEWPM.recordError() raise CapturedError(expr, errid, "retracting")
def predUpdate(agent, bindings, expr): imp = bindings.bImp(agent, expr) try: return imp.conclude(agent, bindings, expr) except NotLocatedError: errid = NEWPM.recordError() raise CapturedError(expr, errid, "concluding")
def find_tframes(self, agent): debug("DoEvent.find_tframes") try: imp = agent.getImp(self._symbol) tframes = imp.tframes(agent, self, self.getBindings(), self._taskexpr[0]) debug("DoEvent.find_tframes -> %s", tframes) return tframes except NotLocatedError, err: errid = NEWPM.recordError() raise CapturedError(self._taskexpr, errid, "doing")
def pyMod(modname, funname): import sys try: __import__(modname) except ImportError, e: errid = NEWPM.recordError() #import traceback #print "EXCEPTION IN", self.name #traceback.print_exception(*self.exc_info) raise UnlocatedError("Error importing Python module %s:\n[%d] %s"%(modname, errid, e))
def pyMod(modname, funname): import sys try: __import__(modname) except ImportError, e: errid = NEWPM.recordError() #import traceback #print "EXCEPTION IN", self.name #traceback.print_exception(*self.exc_info) raise UnlocatedError("Error importing Python module %s:\n[%d] %s" % (modname, errid, e))
def predSolve1(agent, bindings, expr): imp = bindings.bImp(agent, expr) try: if _tracing: _tracing.do_try(agent, bindings, expr) x = imp.solution(agent, bindings, expr) if x: _tracing.do_succeed(agent, bindings, expr) return x _tracing.do_fail(agent, bindings, expr) else: return imp.solution(agent, bindings, expr) except NotLocatedError: errid = NEWPM.recordError() raise CapturedError(expr, errid, "solving")
def predSolve(agent, bindings, expr): imp = bindings.bImp(agent, expr) try: if _tracing: _tracing.do_try(agent, bindings, expr) for x in imp.solutions(agent, bindings, expr): if x: _tracing.do_succeed(agent, bindings, expr) yield x _tracing.do_retry(agent, bindings, expr) _tracing.do_fail(agent, bindings, expr) else: for x in imp.solutions(agent, bindings, expr): yield x except NotLocatedError: errid = NEWPM.recordError() raise CapturedError(expr, errid, "solving")