def runPython(cmd): """Executes the incoming Python commmand in Nuke. @param cmd: Python command @type cmd: str """ import mari_bridge try: exec cmd.strip() except: # Catch everything and report import traceback mari_bridge.errorMsg(traceback.format_exc())
def evalPython(cmd): """Evaluates the incoming Python commmand in Nuke, and returns the result. @param cmd: Python command @type cmd: str @return: The result of the command @rtype: variant (may be any type, including None) @raise None: All exceptions are caught and printed out """ import mari_bridge try: return eval(cmd.strip()) except: # Catch everything and report; implicitly return None import traceback mari_bridge.errorMsg(traceback.format_exc())