python 3.3 mako错误

时间:2013-10-02 19:11:53

标签: python mako

from mako.template import Template
from mako.lookup import TemplateLookup
from mako import exceptions
from mako.exceptions import RichTraceback

def run():
    try:
        s = """
Atomic(ss[2], operand.z);
Atomic(ss[2], operand.z);
Atomic(ss[2], operand.z);
Atomic(ss[2], operand.z);
"""
        t = Template(s)
        print(t.source)
    except:
        traceback = RichTraceback()
        for (filename, lineno, function, line) in traceback.traceback:
            print("File %s, line %s, in %s" % (filename, lineno, function))
            print(line, "\n")
        print("%s: %s" % (str(traceback.error.__class__.__name__), traceback.error))
if __name__ == "__main__":
    run()

错误:

t = Template(s) 

File /usr/lib/python3/dist-packages/mako/template.py, line 273, in __init__
(code, module) = _compile_text(self, text, filename) 

File /usr/lib/python3/dist-packages/mako/template.py, line 615, in _compile_text
generate_magic_comment=template.disable_unicode) 

File /usr/lib/python3/dist-packages/mako/template.py, line 597, in _compile
node = lexer.parse() 

File /usr/lib/python3/dist-packages/mako/lexer.py, line 248, in parse
raise exceptions.CompileException("assertion failed") 

TypeError: __init__() missing 4 required positional arguments: 'source', 'lineno', 'pos', and 'filename'

0 个答案:

没有答案