Mako error on one system not replicated on another

24 Views Asked by At

The Mako community website appears to be polluted and not viewed by anyone who cam provide technical help

Using mako=1.3.0

I run a template program under Linux (Mageia 9) and Windows 10 (2 machines). On one machine, there are no problems, on the other, I get an error: C:\Python\nci> python nci.py Traceback (most recent call last): File "C:\tmp\mako_modules\ncilb.html.py", line 69, in render_body cell = context['cell'] ~~~~~~~^^^^^^^^ File "C:\Users\charm\AppData\Local\Programs\Python\Python311\Lib\site- packages\mako\runtime.py", line 106, in getitem return builtins.dict[key] ~~~~~~~~~~~~~~~~~^^^^^ KeyError: 'cell'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python\nci\nci.py", line 99, in <module>
main()
File "C:\Python\nci\nci.py", line 90, in main
tmpl.render_context(ctx)
File "C:\Users\charm\AppData\Local\Programs\Python\Python311\Lib\site- 
packages\mako\template.py", line 455, in render_context
runtime._render_context(self, self.callable_, context, *args, **kwargs)
File "C:\Users\charm\AppData\Local\Programs\Python\Python311\Lib\site- 
packages\mako\runtime.py", line 916, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "C:\Users\charm\AppData\Local\Programs\Python\Python311\Lib\site- 
packages\mako\runtime.py", line 943, in _exec_template
callable_(context, *args, **kwargs)
File "C:\tmp\mako_modules\ncilb.html.py", line 71, in render_body
raise NameError("'cell' is not defined")
NameError: 'cell' is not defined

The template module is here https://drive.google.com/file/d/1aEYIhTxNnKI05O4zIaIbuhjMrZ8T4N4F/view?usp=sharing

I welcome your help to solve this. Graeme

1

There are 1 best solutions below

0
Ian Wilson On

I would think that probably strict_undefined=True is set on one machine and not the other.

What happens if I reference a variable name that is not in the current context? - The value you get back is a special value called UNDEFINED, or if the strict_undefined=True flag is used a NameError is raised. ...

Docs: context-variables