I am facing a peculiar problem. Every so often template rendering fails because path to the template is not found. If I refresh the browser a few times (i.e. reexecute the same code) , the page is displayed. The code fails at the highlighted line in the template.py of web.py. When I checked the reason I found path variable was getting set to None. Any idea what is going on?
def _load_template(self, name):
kind, path = self._lookup(name)
if kind == 'dir':
return Render(path, cache=self._cache is not None, base=self._base, **self._keywords)
elif kind == 'file':
return Template(open(path).read(), filename=path, **self._keywords)
else:
raise AttributeError, "No template named " + name