Error while viewing Profit and Loss Statement filtered by Project

Hi, I have tried to view Profit & Loss Statement with Project, and it showed Error:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 55, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 20, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 55, in execute_cmd
return, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 1007, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 489, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, line 174, in run
result = generate_report_result(report, filters, user)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/”, line 65, in generate_report_result
res = frappe.get_attr(method_name)(frappe._dict(filters))
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/profit_and_loss_statement/”, line 16, in execute
ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/”, line 148, in get_data
gl_entries_by_account, ignore_closing_entries=ignore_closing_entries
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/”, line 342, in set_gl_entries_by_account
additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/report/”, line 385, in get_additional_conditions
filters.project = [d.strip() for d in projects.strip().split(‘,’) if d]
TypeError: a bytes-like object is required, not ‘str’

Does anyone have the similar problem and how to fix it? Thank you


I get a similar error. has anybody figured out the reason for this error please?

Thank you.

@Max3 @minhtran
Have you get solution on it. I had same error. If you got solution please let me know.
Thank you

Solved this error

Edit below line

projects = frappe.safe_encode(filters.get(“project”))

from "apps/erpnext/erpnext/accounts/report/” to

projects = filters.get(“project”)

1 Like


For some reason, I am not able to find the “projects = frappe.safe_encode(filters.get(“project”)) " line within the '” file.

I’m also having the same problem permission problem with this report
apps/erpnext/erpnext/stock/report/stock_ageing/ I need to stop the non-accounts users from adding the Last purchase price as a column to the stock ageing report.

I’m on V13.13.0.

Any help is really appreciated. Thanks.