Ask Your Question

Revision history [back]

Errors with sage_eval


I try to use function sage_eval and It seems for me that either I found bug either I don't understand smth.

cmds = """
def somef():
    return 443
res = somef()"""
sage_eval('res', cmds = cmds)

NameError: global name '_sage_const_443' is not defined

sage_eval('res', cmds="def somef(): return 443; res=somef()")

NameError: name 'res' is not defined.

Please give me some hints how to solve this problem. Thanks in advance.

Best regards, Andrei.