Google Groups Home
Help | Sign in
Message from discussion ImportError: No module named template_util
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Tobias  
View profile
 More options May 13, 5:45 am
From: Tobias <bruno-the-questiona...@gmx.net>
Date: Tue, 13 May 2008 02:45:21 -0700 (PDT)
Local: Tues, May 13 2008 5:45 am
Subject: Re: ImportError: No module named template_util
Hi, Chris,

thanks for answering.

On 13 Mai, 09:40, Christoph Zwerschke <c...@online.de> wrote:

> Tobias schrieb:

> > I have a controller method which should point to the proper URL;
> > however, all I get is the ImportError mentioned above, which is of no
> > use to me. Of course, I'm totally unaware of a module named
> > template_util I'd be responsible of;

> template_util is an internal module of Kid that normally you needn't
> care about. The template looks ok. You probably need to show us the
> controller and the full stack trace. Do you have the latest TurboKid
> (1.0.4) installed?

Yep: TurboKid-1.0.4-py2.5.egg

> Recent Kid versions give much better error messages.

Well, here it is:

Page handler: <bound method Root.ma of <myapp.controllers.Root object
at 0x0177DC50>>
Traceback (most recent call last):
  File "C:\Interpreter\Python25\lib\site-packages\cherrypy-2.3.0-
py2.5.egg\cherrypy\_cphttptools.py", line 121, in _run
    self.main()
  File "C:\Interpreter\Python25\lib\site-packages\cherrypy-2.3.0-
py2.5.egg\cherrypy\_cphttptools.py", line 264, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in ma
  File "c:\interpreter\python25\lib\site-packages\TurboGears-1.0.4.4-
py2.5.egg\turbogears\controllers.py", line 365, in expose
    *args, **kw)
  File "<string>", line 5, in run_with_transaction
  File "c:\interpreter\python25\lib\site-packages\TurboGears-1.0.4.4-
py2.5.egg\turbogears\database.py", line 405, in sa_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "c:\interpreter\python25\lib\site-packages\TurboGears-1.0.4.4-
py2.5.egg\turbogears\controllers.py", line 380, in <lambda>
    mapping, fragment, args, kw)))
  File "c:\interpreter\python25\lib\site-packages\TurboGears-1.0.4.4-
py2.5.egg\turbogears\controllers.py", line 421, in _execute_func
    return _process_output(output, template, format, content_type,
mapping, fragment)
  File "c:\interpreter\python25\lib\site-packages\TurboGears-1.0.4.4-
py2.5.egg\turbogears\controllers.py", line 87, in _process_output
    fragment=fragment)
  File "c:\interpreter\python25\lib\site-packages\TurboGears-1.0.4.4-
py2.5.egg\turbogears\view\base.py", line 129, in render
    return engine.render(**kw)
  File "C:\Interpreter\Python25\lib\site-packages\turbokid-1.0.4-
py2.5.egg\turbokid\kidsupport.py", line 182, in render
    tclass = self.load_template(template)
  File "C:\Interpreter\Python25\lib\site-packages\turbokid-1.0.4-
py2.5.egg\turbokid\kidsupport.py", line 150, in load_template
    mod = _compile_template(package, basename, tfile, classname)
  File "C:\Interpreter\Python25\lib\site-packages\turbokid-1.0.4-
py2.5.egg\turbokid\kidsupport.py", line 16, in _compile_template
    mod = kid.load_template(tfile, name=classname)
  File "C:\Interpreter\Python25\lib\site-packages\kid-0.9.6-py2.5.egg
\kid\__init__.py", line 160, in load_template
    store=cache, ns=ns, exec_module=exec_module)
  File "C:\Interpreter\Python25\lib\site-packages\kid-0.9.6-py2.5.egg
\kid\importer.py", line 147, in _create_module
    raise_template_error(module=name, filename=filename)
  File "C:\Interpreter\Python25\lib\site-packages\kid-0.9.6-py2.5.egg
\kid\importer.py", line 143, in _create_module
    exec code in mod.__dict__
  File "T:\Projekt\My-App\myapp\templates\ma.py", line 5, in <module>
  File "T:\Projekt\My-App\myapp\templates\kid.py", line 6, in <module>
ImportError: No module named template_util
Error in code generated from template file 'T:\\Projekt\\My-App\\myapp\
\templates\\ma.kid'

And the controller:

class Root(controllers.RootController):
    @expose(template="myapp.templates.welcome")
    def index(self):
        # return '<h1>Hello World</h1>'
        import time
        # log.debug("Happy TurboGears Controller Responding For Duty")
        flash("Your application is now running")
        return dict(now=time.ctime())

...
    @expose()
    def default(self, *args, **kw):
        return "This page is not ready"

...
    @expose(template="myapp.templates.ma")
    def ma(self, ma_nr=None):
        return {'ma_list': [],   # dummy data
                'template': 'list',
                }
        from model import Mitarbeiter
        if ma_nr is None:
            return dict(ma_list=Mitarbeiter.query.all(),
                        template='list')
        else:
            return dict(ma=Mitarbeiter.query(ma_nr=ma_nr),
                        template='item')

> Recent Kid versions give much better error messages. The main advantage
> of Genshi is better performance. I'm not aware of anybody using TAL with
> TurboGears, probably because Kid/Genshi are very similar and in my
> opinion easier to use and more straightforward than TAL/METAL.

Well, that's a matter of taste; knowing Zope and Roundup, I like the
prototype-data-included philosophy, and there are quite useful error
messages...

> If you're using TG 1.0, I recommend sticking with Kid and switching to
> Genshi when updating to TG 1.1 or 2.0.

Ah, ok. Once it works, I'll consider that ;-)

--
Tobias


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google