Reputation: 71
I am trying to use Mako with my Twisted webserver in Python 3. I have a virtual environment with Mako installed (via pip). I am able to import the Mako package, but not the Template class. Here is the shell output from successfully importing the mako module, and then failing to import its Template class:
>>> import mako
>>> from mako import Template
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Template'
Checking the module in site-packages reveals that there is indeed a template.py script with a Template class inside of it, so it's not missing from the install.
Any help would be greatly appreciated.
Upvotes: 0
Views: 1210
Reputation: 10782
Template
is defined in mako.template
Thus you should use:
from mako.template import Template
Upvotes: 2