Caught TypeError on rendering: __init __ () received an unexpected keyword argument 'use_decimal'

When I start the program, I get the following error message

Caught TypeError while rendering: __init__() got an unexpected keyword argument 'use_decimal' 

Here is my code I am using jquery 1.6.4

 def load_charts(chart_list=None, render_to=''): embed_script = ( '<script type="text/javascript">\n' 'var _chartit_hco_array = %s;\n</script>\n' '<script src="%s" type="text/javascript">\n</script>') if chart_list is not None: if isinstance(chart_list, (Chart, PivotChart)): chart_list = [chart_list] chart_list = [c.hcoptions for c in chart_list] render_to_list = [s.strip() for s in render_to.split(',')] for hco, render_to in izip_longest(chart_list, render_to_list): if render_to: hco['chart']['renderTo'] = render_to embed_script = (embed_script % (simplejson.dumps(chart_list, use_decimal=True), CHART_LOADER_URL)) else: embed_script = embed_script %((), CHART_LOADER_URL) return mark_safe(embed_script) 
+6
source share
2 answers

Signature simplejson.dumps (see documentation ):

 dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None) 

as you can see, there is no use_decimal parameter ... but you call it like this:

 simplejson.dumps(chart_list, use_decimal=True) 

EDIT: Actually digging out this other documentation a bit more. It seems that the use_decimal parameter was added somewhere next to the version of the simplejson library ... I would suggest updating the version of the library to the latest available version!

+2
source

To save another soul, spent excruciating hours.

  pip install simplejson 

NB: This should be done in a virtual env project .

+1
source

Source: https://habr.com/ru/post/904525/


All Articles