Bench update error - Module import failed for UserRole (frappe.core.doctype.userrole.userrole)

Hello Rohit,

Please suggest any solution as my error is still not resolved and it’s related to core level of frappe boot.

Hi @Harsh_Mehta

I have tried to replicate the issue on different system but not able to reproduce the issue. Perhaps, the supervisor has not reload the latest code and therefore you may getting an error.

Hello Rohit,

Thank you for doing things on different system so what next step i have to do for resolved this error as my login did successfully and i browse everything from navigation but when i switched to desk from sidebar menu it just give me error so i thing problem is in only desk loading.

Hi @Harsh_Mehta

Can you please share screenshots or GIF?

Hello Rohit,

Please check.

Do you have custom app?name like erpnextplus? If yes, kindly check git status of this application

Yes I have custom erpnextplus but I have not any GIT repositry for my custom app. So, tell me the next step to resolve this error. As, it works perfact with previous upadtes of erpnext and frappe.

Hi @Harsh_Mehta

Can you manually run this command in the path apps/erpnextplus path and share the output

Hello Rohit,

It give me below output.

fatal: Not a git repository (or any of the parent directories): .git

Hi @Harsh_Mehta

It means git has not initialised, try command git init

Rohit but without git init it previously work with other updates of erpnext and frappe. so is it necessary to make git repository for custom app.

Yes sir

Ok rohit. I have applied command git init for my custom app and now fatal error “fatal: Not a git repository (or any of the parent directories): .git” was gone but that boot error still come

Hi @Harsh_Mehta

Reload the supervisor, nginx and run bench migrate command.
If still error exist, kindly share the content of web.log file

Hello Rohit,

Did with all bench command but not resolved error. and web.log file is empty and below is the content from web.error.log file.

Use ‘–’ to separate paths from revisions, like this:
‘git […] – […]’
fatal: ambiguous argument ‘HEAD’: unknown revision or path not in the working tree.

Hello Rohit,

I removed my custom app then erpnext is again started perfectly. After that, i made git repository for my custom app and when I pulled my custom app from git then it showed error in student module which is not part of my custom app. the error log is shown below. Thank you Rohit for looking into it with long thread.

[frappe@ip-172-16-12-162 frappe-bench]$ bench --site silafrica install-app erpnextplus
Installing erpnextplus…
Updating DocTypes for erpnextplus : [========================================]
Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 153, in install_app
_install_app(app, verbose=context.verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 139, in install_app
add_to_installed_apps(name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 160, in add_to_installed_apps
post_install(rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 224, in post_install
init_singles()
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 242, in init_singles
doc = frappe.new_doc(single)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 579, in new_doc
return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 19, in get_new_doc
frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 37, in make_new_doc
“docstatus”: 0
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 603, in get_doc
return frappe.model.document.get_doc(arg1, arg2)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 49, in get_doc
controller = get_controller(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 34, in get_controller
module = load_doctype_module(doctype, module_name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 184, in load_doctype_module
raise ImportError, ‘Module import failed for {0} ({1})’.format(doctype, module_name)
ImportError: Module import failed for Student Batch Attendance Tool (erpnext.schools.doctype.student_batch_attendance_tool.student_batch_attendance_tool)

Hello Rohit,

Is there any update for how to resolve this student batch attendance module error as without solving this error i can’t install my custom erp app.

student batch attendance tool doctype is not available in the latest version, did you used this doctype in your custom app?

hi,
I do " bench update" and then locally desk work Ok .
but in the server, desk cannot open ! and splash Erpnext stuck !
in inspect tool “frappe.boot = {{ boot }};” thses appear syntax error !

and the fllowing error appear when i try to delete Erpenxt
"ImportError: Module import failed for Has Role (frappe.core.doctype.has_role.has_role) "

How I can fix this ??

Can you please share complete traceback?