Hi, I'm running Cheetah on Ubuntu. The following problems arises with the the official Ubuntu packages and with the latest version from here, but only with Python 3.
from __future__ import print_function
from Cheetah.Template import Template
from Cheetah import ImportHooks
ImportHooks.install()
t = Template(file='test.tmpl')
print(t)
Running it with Python 2 works (almost) fine, except for the warning mentioned in #7:
$> /usr/bin/python2 driver.py
[...]/cheetah3/Cheetah/Compiler.py:1630: UserWarning:
You don't have the C version of NameMapper installed! I'm disabling Cheetah's useStackFrames option as it is painfully slow with the Python version of NameMapper. You should get a copy of Cheetah with compiled C version of NameMapper.
"\nYou don't have the C version of NameMapper installed! "
Test
But running with Python 3 gives the following error (I removed the repeating parts and the full path of the cheetah library.):
$> /usr/bin/python3 driver.py
[...]/cheetah3/Cheetah/Compiler.py:1630: UserWarning:
You don't have the C version of NameMapper installed! I'm disabling Cheetah's useStackFrames option as it is painfully slow with the Python version of NameMapper. You should get a copy of Cheetah with compiled C version of NameMapper.
"\nYou don't have the C version of NameMapper installed! "
Traceback (most recent call last):
File "driver.py", line 6, in <module>
t = Template(file='test.tmpl')
File "[...]/cheetah3/Cheetah/Template.py", line 1337, in __init__
self._compile(source, file, compilerSettings=compilerSettings)
File "[...]/cheetah3/Cheetah/Template.py", line 1638, in _compile
keepRefToGeneratedCode=True)
File "[...]/cheetah3/Cheetah/Template.py", line 772, in compile
settings=(compilerSettings or {}))
File "[...]/cheetah3/Cheetah/Compiler.py", line 1659, in __init__
f = open(file, 'r')
File "[...]/cheetah3/Cheetah/ImportManager.py", line 459, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 520, in doimport
mod = director.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 360, in getmod
mod = owner.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportHooks.py", line 57, in getmod
mod = DirOwner.getmod(self, name)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 213, in getmod
with open(py[0], 'r') as py_code_file:
[...]
File "[...]/cheetah3/Cheetah/ImportManager.py", line 459, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 520, in doimport
mod = director.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 360, in getmod
mod = owner.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportHooks.py", line 57, in getmod
mod = DirOwner.getmod(self, name)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 213, in getmod
with open(py[0], 'r') as py_code_file:
File "[...]/cheetah3/Cheetah/ImportManager.py", line 438, in importHook
pkgnm = packageName(importernm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 104, in packageName
for i in range(len(s) - 1, -1, -1):
RecursionError: maximum recursion depth exceeded while calling a Python object
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 26, in enabled
with open(CONFIG) as f:
File "[...]/cheetah3/Cheetah/ImportManager.py", line 459, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 520, in doimport
mod = director.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 360, in getmod
mod = owner.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportHooks.py", line 57, in getmod
mod = DirOwner.getmod(self, name)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 213, in getmod
with open(py[0], 'r') as py_code_file:
[...]
File "[...]/cheetah3/Cheetah/ImportManager.py", line 459, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 520, in doimport
mod = director.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 360, in getmod
mod = owner.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportHooks.py", line 57, in getmod
mod = DirOwner.getmod(self, name)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 213, in getmod
with open(py[0], 'r') as py_code_file:
File "[...]/cheetah3/Cheetah/ImportManager.py", line 438, in importHook
pkgnm = packageName(importernm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 104, in packageName
for i in range(len(s) - 1, -1, -1):
RecursionError: maximum recursion depth exceeded while calling a Python object
Original exception was:
Traceback (most recent call last):
File "driver.py", line 6, in <module>
t = Template(file='test.tmpl')
File "[...]/cheetah3/Cheetah/Template.py", line 1337, in __init__
self._compile(source, file, compilerSettings=compilerSettings)
File "[...]/cheetah3/Cheetah/Template.py", line 1638, in _compile
keepRefToGeneratedCode=True)
File "[...]/cheetah3/Cheetah/Template.py", line 772, in compile
settings=(compilerSettings or {}))
File "[...]/cheetah3/Cheetah/Compiler.py", line 1659, in __init__
f = open(file, 'r')
File "[...]/cheetah3/Cheetah/ImportManager.py", line 459, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 520, in doimport
mod = director.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 360, in getmod
mod = owner.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportHooks.py", line 57, in getmod
mod = DirOwner.getmod(self, name)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 213, in getmod
with open(py[0], 'r') as py_code_file:
[...]
File "[...]/cheetah3/Cheetah/ImportManager.py", line 459, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 520, in doimport
mod = director.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 360, in getmod
mod = owner.getmod(nm)
File "[...]/cheetah3/Cheetah/ImportHooks.py", line 57, in getmod
mod = DirOwner.getmod(self, name)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 213, in getmod
with open(py[0], 'r') as py_code_file:
File "[...]/cheetah3/Cheetah/ImportManager.py", line 438, in importHook
pkgnm = packageName(importernm)
File "[...]/cheetah3/Cheetah/ImportManager.py", line 104, in packageName
for i in range(len(s) - 1, -1, -1):
RecursionError: maximum recursion depth exceeded while calling a Python object