ERPNEXT 13 suddenly giving module import failed error

Hi,

Im using erpnext 13 version both frappe and erpnext are on same branch 13, but suddenly im getting following error when i logged in

ImportError: Module import failed for Dashboard Chart (frappe.desk.doctype.dashboard_chart.dashboard_chart Error: cannot import name ‘get_allowed_report_names’ from ‘frappe.boot’ (apps/frappe/frappe/boot.py))

Any idea to resolve this issue

Hi,

Is this happening the first time a login is attempted after an upgrade or customization? Or was the the Frappe/ERPNext unchanged from the last successful login by the same user?

This is happening from last ver-13 update. Every time i login it is giving this error.

Try bench setup requirements, then bench --site <sitename> migrate.

is it ok to run this command on production env.

Following are the current versions.

frappe 13.37.1 version-13
erpnext 13.36.3 version-13

It should be fine.

Thank you , i’ll run the command and let you know

issue still persist.

App Versions

{
	"erpnext": "13.33.0",
	"frappe": "13.32.0"
}

Route


Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/modules/utils.py", line 238, in load_doctype_module
    doctype_python_modules[key] = frappe.get_module(module_name)
  File "apps/frappe/frappe/__init__.py", line 1191, in get_module
    kwargs.pop("cmd", None)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "apps/frappe/frappe/desk/doctype/dashboard_chart/dashboard_chart.py", line 12, in <module>
    from frappe.boot import get_allowed_report_names
ImportError: cannot import name 'get_allowed_report_names' from 'frappe.boot' (apps/frappe/frappe/boot.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/desk/form/load.py", line 40, in getdoc
    doc = frappe.get_doc(doctype, name)
  File "apps/frappe/frappe/__init__.py", line 1068, in get_doc
    # open an existing document
  File "apps/frappe/frappe/model/document.py", line 77, in get_doc
    controller = get_controller(doctype)
  File "apps/frappe/frappe/model/base_document.py", line 82, in get_controller
    site_controllers[doctype] = _get_controller()
  File "apps/frappe/frappe/model/base_document.py", line 64, in _get_controller
    module = load_doctype_module(doctype, module_name)
  File "apps/frappe/frappe/modules/utils.py", line 240, in load_doctype_module
    raise ImportError(
ImportError: Module import failed for Dashboard Chart (frappe.desk.doctype.dashboard_chart.dashboard_chart Error: cannot import name 'get_allowed_report_names' from 'frappe.boot' (apps/frappe/frappe/boot.py))

Traceback (most recent call last):
  File "apps/frappe/frappe/modules/utils.py", line 238, in load_doctype_module
    doctype_python_modules[key] = frappe.get_module(module_name)
  File "apps/frappe/frappe/__init__.py", line 1191, in get_module
    kwargs.pop("cmd", None)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "apps/frappe/frappe/desk/doctype/dashboard_chart/dashboard_chart.py", line 12, in <module>
    from frappe.boot import get_allowed_report_names
ImportError: cannot import name 'get_allowed_report_names' from 'frappe.boot' (apps/frappe/frappe/boot.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, 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 38, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1448, in call
  File "apps/frappe/frappe/desk/form/load.py", line 40, in getdoc
    doc = frappe.get_doc(doctype, name)
  File "apps/frappe/frappe/__init__.py", line 1068, in get_doc
    # open an existing document
  File "apps/frappe/frappe/model/document.py", line 77, in get_doc
    controller = get_controller(doctype)
  File "apps/frappe/frappe/model/base_document.py", line 82, in get_controller
    site_controllers[doctype] = _get_controller()
  File "apps/frappe/frappe/model/base_document.py", line 64, in _get_controller
    module = load_doctype_module(doctype, module_name)
  File "apps/frappe/frappe/modules/utils.py", line 240, in load_doctype_module
    raise ImportError(
ImportError: Module import failed for Dashboard Chart (frappe.desk.doctype.dashboard_chart.dashboard_chart Error: cannot import name 'get_allowed_report_names' from 'frappe.boot' (apps/frappe/frappe/boot.py))

Request Data

{
	"type": "GET",
	"args": {
		"doctype": "Dashboard Chart",
		"name": "Outgoing Salary"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.load.getdoc"
}

Response Data

{
	"exception": "ImportError: Module import failed for Dashboard Chart (frappe.desk.doctype.dashboard_chart.dashboard_chart Error: cannot import name 'get_allowed_report_names' from 'frappe.boot' (apps/frappe/frappe/boot.py))"
}

Does the error happen if logged in as administrator?

yes it still shows for administrator account.

Should i migrate to ver-14 branch?

@smino
Issue was gone after system restart.

1 Like