I’m working on v7. I am trying to use frappe.msgprint from my custom python code.
However, I am faced with this error on my console:
This only occurs when I am printing a variable with an assigned value.
If I were to do a simple
frappe.msgprint(“hello”), there are no issues.
Thank you for any help.
What are you trying to print?
I’m trying to print a variable, with a calculated value of type float/int. Thank you.
@rmehta Even I have faced this issue, when we try to print a LIST in
frappe.msgprint then the list earlier used to show as python list but now it is rendered as separate elements and show in the next line so
frappe.msgprint(["foo", "bar"]) would earlier show as below:
But now it shows as:
Also this error mentioned by
@fachristy would come when we try to
msgprint a dict variable.
Any update as to how can we debug the lists and dicts in v7 since the
frappe.msgprint now does not support dicts to be printed.
I like to use json dump.
using str, it is giving error but we can use String without error. Anyway, it did not work to display the dictionary content as needed.
Anyway, I was only able to display the content of the dictionary using alert(JSON.stringify(dict)); and I was not able to achieve this using msgprint or frappe.msgprint.
on server side you can use
frappe.msgprint('<pre>' + JSON.stringify(my_dict, null, 2) + '</pre>');