pixiedust_node icon indicating copy to clipboard operation
pixiedust_node copied to clipboard

Will not display any graphs

Open BlogBlocks opened this issue 7 years ago • 5 comments

This is the error I got:

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

BlogBlocks avatar Jul 02 '18 05:07 BlogBlocks

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?

glynnbird avatar Jul 02 '18 07:07 glynnbird

This will fix it . `https://github.com/pallets/jinja/pull/456/commits/7b4393dc86f17d67e1711cd9aa02ff40366519b4

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 avatar Jul 02 '18 09:07 BlogBlocks

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

!pip install -U jinja2

DTAIEB avatar Jul 02 '18 11:07 DTAIEB

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.

ptitzler avatar Jul 09 '18 20:07 ptitzler

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

BlogBlocks avatar Jul 16 '18 05:07 BlogBlocks