Try ERPNext Buy Support Partners Foundation Foundation Members

Uncaught Server Exception within Cart View

Please assist, I have an error when using the Cart on the Hosted Version (currently on Trial). I have tried this on two separate installations, and when the cart is populated I get the same error.

Is this going to be fixed in the next update?

Thanks for posting - please could you copy and paste the complete traceback?

Screen grabs make it not so easy to dig into the code…

Possibly but that depends, updates often occur daily.

Welcome to ERPNext!

Traceback (most recent call last):
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/website/render.py”, line 45, in render
data = render_page_by_language(path)
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/website/render.py”, line 142, in render_page_by_language
return render_page(path)
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/website/render.py”, line 158, in render_page
return build(path)
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/website/render.py”, line 165, in build
return build_page(path)
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/website/render.py”, line 181, in build_page
html = frappe.render_template(context.source, context)
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/utils/jinja.py”, line 75, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/benches/bench-2019-01-23/env/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/benches/bench-2019-01-23/env/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 1, in top-level template code
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/./templates/web.html”, line 6, in top-level template code
{%- if page_or_generator==“Generator” %}source-type=“Generator” data-doctype="{{ doctype }}"{% endif %}
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/./templates/base.html”, line 37, in top-level template code
{% block body %}
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/./templates/base.html”, line 63, in block “body”
{% block content %}{% endblock %}
File “/home/frappe/benches/bench-2019-01-23/apps/frappe/frappe/./templates/web.html”, line 49, in block “content”
{%- block page_content -%}{%- endblock -%}
File “”, line 42, in block “page_content”
File “/home/frappe/benches/bench-2019-01-23/apps/erpnext/erpnext/./templates/includes/cart/cart_items.html”, line 29, in top-level template code
_(“Rate: {0}”).format(d.get_formatted(“rate”)) }}


UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa3’ in position 0: ordinal not in range(128)

Thanks!

Some additional info please, when and where do you get the error -

Please post a screenshot of the shopping cart render view just before the error occurs. Say when you Click on “Add to Cart” to add item to shopping cart?

The UnicodeError arises since a non-ASCII character appears for the rate value - ASCII is the default encoding in Python.

Another idea -

The problem is with position 0, so maybe the currency symbol is the problem!?
In which case in Global Defaults ‘Hide Currency Symbol’ to hide the symbol might point to the problem?

I myself am not familiar with the shopping cart

edit: Possibly a setup problem but probably best report this on https://github.com/frappe/erpnext/issues

If you are curious here are two worthwhile reads on encodings:

https://docs.python.org/2/howto/unicode.html#encodings

https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/

Hi John

Hiding the currency symbol solved the issue.

Many thanks

Excellent news thanks

Reported here for the record https://github.com/frappe/erpnext/issues/16517

My guess is this error will resolve itself once erpnext.com moves to Python 3.