KeyError: u'print' by update from v6 to v8

Hi,

Getting below error while upgrading from v 6.2 to 8. Can I get some help to solve it?

Patching sites…
Migrating …
Executing frappe.patches.v7_1.disabled_print_settings_for_custom_print_format in … (a7135558a1)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, 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 “/opt/erpnext5/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/opt/erpnext5/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/opt/erpnext5/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/pierre/erpnext5/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/commands/site.py”, line 211, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py”, line 9, in execute
frappe.reload_doctype(‘Print Format’)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/init.py”, line 651, in reload_doctype
force=force, reset_permissions=reset_permissions)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/init.py”, line 663, in reload_doc
return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 152, in reload_doc
return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 19, in import_files
reset_permissions=reset_permissions)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 23, in import_file
path = get_file_path(module, dt, dn)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 30, in get_file_path
path = os.path.join(get_module_path(module),
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 144, in get_module_path
return frappe.get_module_path(module)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/init.py”, line 688, in get_module_path
return get_pymodule_path(local.module_app[module] + “.” + module, *joins)
KeyError: u’print’

Cheers neacal

I just hit the same issue when doing another test upgrade.

I opened a new github ticket for this here: KeyError: u'print' from patch v7_1.disabled_print_settings_for_custom_print_format · Issue #8697 · frappe/erpnext · GitHub

There seems to be a rash of errors in the update scripts lately. They get fixed pretty promptly. Should the CI jobs be running bench update to try and errors in the patches?

https://github.com/frappe/erpnext/issues/8623
Error during `bench update --upgrade` · Issue #8618 · frappe/erpnext · GitHub (Fixed)
v8 error on bench update DoesNotExistError: DocType Student Admission not found · Issue #8590 · frappe/erpnext · GitHub (Fixed)

Pushed a fix in the latest release, please update again.

Thanks for that fix nabinhait! Now the update script stops at this point:

Success
Executing erpnext.patches.v7_2.update_assessment_modules in … (a7135558a1)
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, 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 “/opt/erpnext5/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/opt/erpnext5/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/opt/erpnext5/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/pierre/erpnext5/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, kwargs)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/commands/site.py”, line 211, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
frappe.modules.patch_handler.run_all()
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/pierre/erpnext5/frappe-bench/apps/erpnext/erpnext/patches/v7_2/update_assessment_modules.py”, line 6, in execute
** frappe.rename_doc(“DocType”, “Grading Structure”, “Grading Scale”, force=True)

File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/init.py”, line 668, in rename_doc
return rename_doc(*args, **kwargs)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/model/rename_doc.py”, line 38, in rename_doc
rename_parent_and_child(doctype, old, new, meta)
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/model/rename_doc.py”, line 95, in rename_parent_and_child
(new, old))
File “/home/pierre/erpnext5/frappe-bench/apps/frappe/frappe/database.py”, line 138, in sql
self._cursor.execute(query, values)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/opt/erpnext5/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.IntegrityError: (1062, “Duplicate entry ‘Grading Scale’ for key ‘PRIMARY’”)

Best regards
neacal

Hallo,
i am also interested about this bug, any suggestions? Anybody of the frappe members, who can help?

I plan to use erpnext for a company and want to promote it for other customers.
But if it is not possible to update it, it should not be a good idea to use erpnext. Other ERP-Systems work more properly.

Thanks @the team
Frank

Free upgrades are rare

I’ve been upgrading it with customisation since v3. The only difference is I upgrade regularly and never skip a major version.

I faced this issue on a v6 instance which missed upgrade, for now I’ve switched to v7.0.0 tag/branch for this database and did bench migrate; bench build It is working fine on v7.0.0

I am not convinced Frank is listening!

Hallo, we also tried to upgrade to 7.0 - but it was the same. :angry:
In the version 7.0 are significant changes in the db.