Help. Error in Switch to Develop

Base System Ubuntu Server 14.04

ERPNext: v6.27.25
Frappe Framework: v6.27.24

Comands Used
cd /home/frappe/bench-repo/
sudo git checkout develop
sudo git fetch origin develop
cd /home/frappe/frappe-bench/
sudo bench switch-to-develop --upgrade

Error Code:
Executing erpnext.patches.v7_0.setup_account_table_for_expense_claim_type_if_exists in site1.local (
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 “/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/local/lib/python2.7/site-packages/click/core.py”, line 716, in
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, i
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, i
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 1c
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 182, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 27, in migrate
frappe.modules.patch_handler.run_all()
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 25, in run_all
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 52, in run_sing
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 68, in execute

frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v7_0/setup_account_table_for_expense__exists.py”, line 12, in execute
“default_account”: expense_claim_type.default_account,
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 134, in append
value = self._init_child(value, key)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 161, in init_chi
value = get_controller(value[“doctype”])(value)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 32, in get_contro
module = load_doctype_module(doctype, module_name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/init.py”, line 64, in load_doctype

doctype_python_modules[key] = frappe.get_module(get_module_name(doctype, module, prefix, suffix)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 643, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named expense_claim_account.expense_claim_account
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==3.0.0’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 145, in switch_to_develop
switch_to_develop(upgrade=upgrade, apps=[‘frappe’, ‘erpnext’])
File “/home/frappe/bench-repo/bench/app.py”, line 249, in switch_to_develop
switch_branch(‘develop’, apps=apps, bench_path=bench_path, upgrade=upgrade)
File “/home/frappe/bench-repo/bench/app.py”, line 238, in switch_branch
patch_sites()
File “/home/frappe/bench-repo/bench/utils.py”, line 122, in patch_sites
run_frappe_cmd(‘–site’, ‘all’, ‘migrate’, bench_path=bench_path)
File “/home/frappe/bench-repo/bench/utils.py”, line 451, in run_frappe_cmd
raise CommandFailedError(args)
bench.utils.CommandFailedError: (‘–site’, ‘all’, ‘migrate’)
root@testeo:/home/frappe/frappe-bench# https://help.ubuntu.com/
-bash: https://help.ubuntu.com/: No such file or directory
root@testeo:/home/frappe/frappe-bench#
root@testeo:/home/frappe/frappe-bench# https://help.ubuntu.com/
-bash: https://help.ubuntu.com/: No such file or directory

You shouldn’t use root to be doing git or bench commands (unless it’s necessary) this could change permissions for your files / folders and cause unwanted effects.

Can you go into both frappe and erpnext folder inside frappe-bench/apps and run git status and paste the outputs here? Make sure to run these commands from a non-root user.

Thansk for your reply.

frappe@testeo:~/frappe-bench/apps/frappe$ git status
On branch develop
Your branch is up-to-date with ‘upstream/develop’.

nothing to commit, working directory clean

frappe@testeo:~/frappe-bench/apps/erpnext$ git status
On branch develop
Your branch is up-to-date with ‘upstream/develop’.

nothing to commit, working directory clean

Hm, odd, it seems fine. Run bench migrate from frappe-bench? Does it give the same error?

There was an issue in patch, fixed via Patch fixed for expense claim type by nabinhait · Pull Request #5800 · frappe/erpnext · GitHub.

Please update again.

2 Likes

Thanks ! its working fine now