Not able to use `setup_wizard_complete`

From the hooks page of frappe documentation, It states that one can use setup_wizard_complete hook to run custom script after setup has been complete, But doing so give me error.

09:45:07 web.1      |     stages = get_setup_stages(args)
09:45:07 web.1      |              ^^^^^^^^^^^^^^^^^^^^^^
09:45:07 web.1      |   File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 29, in get_setup_stages
09:45:07 web.1      |     stages += get_stages_hooks(args) + get_setup_complete_hooks(args)
09:45:07 web.1      |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
09:45:07 web.1      |   File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 139, in get_setup_complete_hooks
09:45:07 web.1      |     {"fn": frappe.get_attr(method), "args": args, "fail_msg": "Failed to execute method"}
09:45:07 web.1      |            ^^^^^^^^^^^^^^^^^^^^^^^
09:45:07 web.1      |   File "apps/frappe/frappe/__init__.py", line 1588, in get_attr
09:45:07 web.1      |     app_name = method_string.split(".", 1)[0]
09:45:07 web.1      |                ^^^^^^^^^^^^^^^^^^^
09:45:07 web.1      | AttributeError: 'set' object has no attribute 'split'
09:45:07 web.1      | 
09:45:07 web.1      | 172.20.0.9 - - [19/Jun/2023 09:45:07] "POST /api/method/frappe.desk.page.setup_wizard.setup_wizard.setup_complete HTTP/1.1" 500 -
09:46:20 web.1      | Traceback (most recent call last):
09:46:20 web.1      |   File "apps/frappe/frappe/app.py", line 66, in application
09:46:20 web.1      |     response = frappe.api.handle()
09:46:20 web.1      |                ^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/api.py", line 54, in handle
09:46:20 web.1      |     return frappe.handler.handle()
09:46:20 web.1      |            ^^^^^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/handler.py", line 47, in handle
09:46:20 web.1      |     data = execute_cmd(cmd)
09:46:20 web.1      |            ^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
09:46:20 web.1      |     return frappe.call(method, **frappe.form_dict)
09:46:20 web.1      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/__init__.py", line 1608, in call
09:46:20 web.1      |     return fn(*args, **newargs)
09:46:20 web.1      |            ^^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 55, in setup_complete
09:46:20 web.1      |     stages = get_setup_stages(args)
09:46:20 web.1      |              ^^^^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 29, in get_setup_stages
09:46:20 web.1      |     stages += get_stages_hooks(args) + get_setup_complete_hooks(args)
09:46:20 web.1      |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 139, in get_setup_complete_hooks
09:46:20 web.1      |     {"fn": frappe.get_attr(method), "args": args, "fail_msg": "Failed to execute method"}
09:46:20 web.1      |            ^^^^^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      |   File "apps/frappe/frappe/__init__.py", line 1588, in get_attr
09:46:20 web.1      |     app_name = method_string.split(".", 1)[0]
09:46:20 web.1      |                ^^^^^^^^^^^^^^^^^^^
09:46:20 web.1      | AttributeError: 'set' object has no attribute 'split'
  • I have implemented this hook as
setup_wizard_complete ={
    "appname.setup.update_city"
}

Define the hook like so:

setup_wizard_complete = [
    "appname.setup.update_city"
]
 TypeError: update_city() takes 0 positional arguments but 1 was given
  • There are no parameters to the function, yet gives me an error like this.

Update
just pass args as parameter to function call as these details will be passed to executing function.

{'language': 'English', 'enable_telemetry': 0, 'country': 'India', 'timezone': 'Asia/Kolkata', 'currency': 'INR', 'company_name': 'rtCamp', 'company_abbr': 'R', 'chart_of_accounts': 'India - Chart of Accounts', 'fy_start_date': '2023-04-01', 'fy_end_date': '2024-03-31'}
1 Like