I am trying to write a simple frappe script report The site is in developer mode but I am not writing this script in a file. Just creating a report on browser and pasting this code in script section in browser itself.
Traceback (most recent call last):
File âapps/frappe/frappe/app.pyâ, line 95, in application
response = frappe.api.handle()
^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/api.pyâ, line 55, in handle
return frappe.handler.handle()
^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/handler.pyâ, line 47, in handle
data = execute_cmd(cmd)
^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/handler.pyâ, line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/init.pyâ, line 1628, in call
return fn(*args, **newargs)
^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/init.pyâ, line 808, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/desk/query_report.pyâ, line 239, in run
result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/init.pyâ, line 808, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/desk/query_report.pyâ, line 89, in generate_report_result
res = get_report_result(report, filters) or
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/desk/query_report.pyâ, line 70, in get_report_result
res = report.execute_script_report(filters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/core/doctype/report/report.pyâ, line 133, in execute_script_report
res = self.execute_script(filters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âapps/frappe/frappe/core/doctype/report/report.pyâ, line 155, in execute_script
safe_exec(self.report_script, None, loc)
File âapps/frappe/frappe/utils/safe_exec.pyâ, line 86, in safe_exec
compile_restricted(script, filename=ââ, policy=FrappeTransformer),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âenv/lib/python3.11/site-packages/RestrictedPython/compile.pyâ, line 196, in compile_restricted
result = _compile_restricted_mode(
^^^^^^^^^^^^^^^^^^^^^^^^^
File âenv/lib/python3.11/site-packages/RestrictedPython/compile.pyâ, line 67, in _compile_restricted_mode
byte_code = compile(c_ast, filename, mode=mode # ,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ââ, line 11
SyntaxError: âreturnâ outside function