Print Format error linked to Jinja2 "equalto" test

HI, we have a Print Format that runs perfectly on one Production system but fails with the following error on another Production system. Both are running the same versions of erpnext 6.27.9 & frappe 6.27.10.

Traceback (innermost last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 57, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 19, in handle
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 36, in execute_cmd
ret =, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 805, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/templates/pages/”, line 142, in get_html_and_style
no_letterhead=no_letterhead, trigger_print=trigger_print),
File “/home/frappe/frappe-bench/apps/frappe/frappe/templates/pages/”, line 121, in get_html
html = template.render(args, filters={“len”: len})
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 969, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 76, in top-level template code
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 740, in do_list
return list(value)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 931, in _select_or_reject
if modfunc(func(transfunc(item))):
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 925, in
name, item, args, kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/”, line 438, in call_test
raise TemplateRuntimeError(‘no test named %r’ % name)
TemplateRuntimeError: no test named ‘equalto’

From what we can tell, the error is linked to the following issue with differing versions of Jinja2:-

The system that the Print Format fails on is running Jinja2 v2.7.3, and the successful one is running v2.8

For the “equalto” test to run, Jinja2 needs to be at least v2.7.8

Can anyone point me to the correct way to update Jinja2 the correct way?


Go into the frappe-bench directory and run:

./env/bin/pip install --upgrade jinja2

Hi @vjFaLk, thanks for the help. I ran the upgrade and now “pip show jinja2” shows version 2.8.

However, the error “TemplateRuntimeError: no test named ‘equalto’” is still coming up when using my custom Print Format.

Any other ideas?


Did you do ./env/bin/pip show jinja2?

Maybe try restarting bench?

This is very odd.

Yes, results were:-
Metadata-Version: 2.0
Name: Jinja2
Version: 2.8
Summary: A small but fast and easy to use stand-alone template engine written in pure python.
Author: Armin Ronacher
Installer: pip
License: BSD
Location: /home/frappe/frappe-bench/env/lib/python2.7/site-packages
Requires: MarkupSafe
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Text Processing :: Markup :: HTML
jinja2 = jinja2.ext:babel_extract[i18n]

I have restarted the bench as well as restarting the server. I suppose last resort would be to install a new server and restore the database from a backup.

OK, for anyone that runs into a similar issue, I seem to have got it working - although not sure why!

Firstly I ran “bench clear-cache” and then deleted the file after making a backup.

After restarting the server, the custom Print Format works now with no errors.

Then, out of curiosity, I replaced the file and surprisingly the Print Format still worked as expected with no errors.