J-a-n-u-s
J-a-n-u-s

Reputation: 1587

Gevent - ImportError: No module named mako_templating

I’m following a video from 2012 - Gevent-socketio, cross-framework real-time web live demo (https://www.youtube.com/watch?v=zhh_N5pmHBY)

I’m working on Ubuntu 15.04.

At 8 mins, in init.py he corrects config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory') but after that I still can’t get it to work. The error I’m getting is below.

Any and all help would be greatly appreciated.

Thank you

(env)cloud@cloudnetwork:~/Code/python/3/moo/Moo$ pserve --reload development.ini
Starting subprocess with file monitor
Traceback (most recent call last):
 File "/home/cloud/Code/python/3/moo/env/bin/pserve", line 9, in <module>
   load_entry_point('pyramid==1.5.7', 'console_scripts', 'pserve')()
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 58, in main
   return command.run()
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 328, in run
   global_conf=vars)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 363, in loadapp
   return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
   return loadobj(APP, uri, name=name, **kw)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
   return context.create()
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
   return self.object_type.invoke(self)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
   return fix_call(context.object, context.global_conf, **context.local_conf)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
   val = callable(*args, **kw)
 File "/home/cloud/Code/python/3/moo/Moo/moo/__init__.py", line 10, in main
   config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory')
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/util.py", line 528, in wrapper
   result = wrapped(self, *arg, **kw)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/rendering.py", line 33, in add_renderer
   factory = self.maybe_dotted(factory)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 825, in maybe_dotted
   return self.name_resolver.maybe_resolve(dotted)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 320, in maybe_resolve
   return self._resolve(dotted, package)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 327, in _resolve
   return self._zope_dottedname_style(dotted, package)
 File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 382, in _zope_dottedname_style
   __import__(used)
ImportError: No module named mako_templating

Upvotes: 1

Views: 1420

Answers (2)

X-Istence
X-Istence

Reputation: 16667

The easiest way to register a new extension to be processed as a Mako template in Pyramid is as follows:

config.include('pyramid_mako')
config.add_mako_renderer('.html')

This will set up the renderer correctly.


Mako templating was removed from the Pyramid core framework, and thus pyramid.mako_templating.* no longer exists.

Upvotes: 3

favoretti
favoretti

Reputation: 30167

Depending on how you installed pyramid, you also need to install pyramid_mako, for instance by running pip install pyramid_mako. It's a separate module and is not a part of pyramid itself.

Upvotes: 0

Related Questions