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

Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in runmodule_as_main
“main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in runcode
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 processresult(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 processresult(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
installapp(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,

have you checked my traceback ?

Hi @Harsh_Mehta

Yes we are working on the issue and soon we’ll give you an updates on it
cc @ManasSolanki

Thank you Rohit.

HI,

We still get the same , Only erpnext icon visible in Desk.

File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/website/context.py”, line 46, in update_controller_context
12:35:57 web.1 | ret = module.get_context(context)
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/www/desk.py”, line 21, in get_context
12:35:57 web.1 | boot = frappe.sessions.get()
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/sessions.py”, line 150, in get
12:35:57 web.1 | bootinfo = get_bootinfo()
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/boot.py”, line 72, in get_bootinfo
12:35:57 web.1 | bootinfo.update(get_email_accounts(user=frappe.session.user))
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/email/inbox.py”, line 12, in get_email_accounts
12:35:57 web.1 | distinct=True, order_by=“idx”)
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/init.py”, line 1136, in get_all
12:35:57 web.1 | return get_list(doctype, *args, **kwargs)
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/init.py”, line 1109, in get_list
12:35:57 web.1 | return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 83, in execute
12:35:57 web.1 | result = self.build_and_run()
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 107, in build_and_run
12:35:57 web.1 | return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug, update=self.update)
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/database.py”, line 149, in sql
12:35:57 web.1 | self._cursor.execute(query)
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
12:35:57 web.1 | self.errorhandler(self, exc, value)
12:35:57 web.1 | File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
12:35:57 web.1 | raise errorclass, errorvalue
12:35:57 web.1 | InterfaceError: (-1, ‘error totally whack’)

We are trying to run in Amazon AWS.

We are awaiting your reply

@Prabhu_S,

Can you please try to run the bench migrate command

Thanks,
Makarand

Updating DocTypes for frappe : [========================================]
Updating DocTypes for erpnext : [========================================]
Syncing help database…
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/commands/site.py”, line 210, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/migrate.py”, line 52, in migrate
frappe.utils.help.sync()
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/utils/help.py”, line 23, in sync
help_db.make_table()
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/utils/help.py”, line 80, in make_table
CHARACTER SET=utf8mb4’‘’)
File “/home/ubuntu/bench/frappe-bench/apps/frappe/frappe/database.py”, line 149, in sql
self._cursor.execute(query)
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/ubuntu/bench/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1071, ‘Specified key was too long; max key length is 1000 bytes’)

We getting the above error @makarand_b

i have the same error too… pls fix this

Hello,

I have used below steps and it remove that student batch attendance doctype also they have fixed this issue in new version. So please update your ERPNext version or do below steps.

Go to bench console
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
Type “copyright”, “credits” or “license” for more information.

IPython 5.1.0 – An enhanced Interactive Python.
? → Introduction and overview of IPython’s features.
%quickref → Quick reference.
help → Python’s own help system.
object? → Details about ‘object’, use ‘object??’ for extra details.

In [1]: frappe.delete_doc(‘DocType’, ‘Student Batch Attendance Tool’)

In [2]: frappe.db.commit()

In [3]:
Do you really want to exit ([y]/n)? y

Then Apply command : bench migrate