Hi,
I have a customization in item code wherein the description is automatically generated. The problem is that I have started to get this encoding error after updating to v11, would need to know how could I resolve this error:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
doc.save()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 260, in save
return self._save(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 283, in _save
self.insert()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 222, in insert
self.run_before_save_methods()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 876, in run_before_save_methods
self.run_method("validate")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1048, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1033, in runner
add_to_return_value(self, f(self, method, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/rigpl_erpnext/rigpl_erpnext/rigpl_erpnext/item.py", line 22, in validate
generate_description(doc,method)
File "/home/frappe/frappe-bench/apps/rigpl_erpnext/rigpl_erpnext/rigpl_erpnext/item.py", line 380, in generate_description
concat = str(prefix[0][0][1:-1]) + str('{0:g}'.format(d.attribute_value))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd8' in position 1: ordinal not in range(128)
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 61, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 21, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1007, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
doc.save()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 260, in save
return self._save(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 283, in _save
self.insert()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 222, in insert
self.run_before_save_methods()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 876, in run_before_save_methods
self.run_method("validate")
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 772, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1048, in composer
return composed(self, method, *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1033, in runner
add_to_return_value(self, f(self, method, *args, **kwargs))
File "/home/frappe/frappe-bench/apps/rigpl_erpnext/rigpl_erpnext/rigpl_erpnext/item.py", line 22, in validate
generate_description(doc,method)
File "/home/frappe/frappe-bench/apps/rigpl_erpnext/rigpl_erpnext/rigpl_erpnext/item.py", line 380, in generate_description
concat = str(prefix[0][0][1:-1]) + str('{0:g}'.format(d.attribute_value))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd8' in position 1: ordinal not in range(128)
The code in question here is:
Now if you see the code there is already a reference to utf-8 here:
but still I am getting an error since the prefix which is getting encoding has a character Ø which is giving this encoding error, is there a way I can remove this error.