pixiedust/pixiedust_node

Will not display any graphs

Opened this issue · 5 comments

This is the error I got:

def join_path(self, template, parent):
\n in template()
\nTemplateAssertionError: no filter named 'tojson'\n

I'm keen to reproduce the error you have spotted but I could do with ore detail. Can you post a minimal block of code that generates the error?

This will fix it .
`pallets/jinja@7b4393d

I was using pixiedust_node and it would not make a graph stating 'to_json' did not exist.
FYI - a window pops up and you must define the graph / plot parameters. It works fine
on Ubuntu 16.04 python2.7 jinja2 VERSION 2.8

in the file ..../jinja2/filters.py
Create the def do_json(value): function and add to right above the 'def do_round(value, function)'

Example:

def do_json(value):
"""A filter that outputs Python objects as JSON"""
import json
return json.dumps(value)

-- this bottom function exists --- place do_json above it --
def do_round(value, precision=0, method='common'):
"""Round the number to a given precision. The first
parameter specifies the precision (default is 0),

Then add ( 'to_json': do_json, ) to the definitions on the bottom of the page:

Example:
'wordcount': do_wordcount,
'wordcount': do_wordcount,
'wordwrap': do_wordwrap,
'wordwrap': do_wordwrap,
'xmlattr': do_xmlattr,
'xmlattr': do_xmlattr,
'to_json': do_json,
`
What I stated above was the exact error I recieved:

@BlogBlocks You may have an old version of JinJa2. Can you try updating it:

!pip install -U jinja2

Upgrading to a more recent version of Jinja2 (2.9.6) fixed the issue for me when I ran into it a little while ago.

I got it working with jinja2 VERSION 2.8
I just had to define 'to_json': do_json,
in filter.py
by adding it to the end of the file