[Calc] Fix things

master
Sfan5 2014-01-06 16:10:13 +01:00
parent 0ebecf3c90
commit 13b3a2ed90
1 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ def eval_(node):
elif isinstance(node, ast.BinOp): # <left> <operator> <right>
return eval_(node.op)(eval_(node.left), eval_(node.right))
elif isinstance(node, ast.Call): # <func> ( <args> )
return getfunc(node.func.id)(*(eval_(e) for e in node.func.args))
return getfunc(node.func.id)(*(eval_(e) for e in node.args))
else:
raise TypeError("AST node type not allowed: '" + type(node).__name__ + "'")
@ -51,7 +51,7 @@ def c(phenny, input):
q = input.group(2).encode('utf-8')
print("[LOG]: %s calculated '%s'" % (input.nick,q))
try:
phenny.say(eval_expr(q))
phenny.say(str(eval_expr(q)))
except Exception as e:
phenny.say("Exception: " + str(e))