Bench Update breaks the system

Hi,

While tacking update using command "bench update "

(env)saurabh@indictrans-To-be-filled-by-O-E-M:~/Documents/projects/PHR/workspace/test_setup/frappe-bench$ bench update
Already up-to-date.
From https://github.com/pawaranand/phr

  • branch master -> FETCH_HEAD
    Already up-to-date.
    remote: Counting objects: 14, done.
    remote: Compressing objects: 100% (12/12), done.
    remote: Total 14 (delta 11), reused 4 (delta 1)
    Unpacking objects: 100% (14/14), done.
    From https://github.com/frappe/erpnext
  • branch develop -> FETCH_HEAD
    2f6a20a…35cd88b develop -> upstream/develop
    Updating 2f6a20a…35cd88b
    Fast-forward
    erpnext/version.py | 2 ±
    erpnext/hooks.py | 2 ±
    erpnext/public/js/transaction.js | 2 ±
    setup.py | 2 ±
    4 files changed, 4 insertions(+), 4 deletions(-)
    From https://github.com/frappe/frappe
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    Traceback (most recent call last):
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/env/bin/frappe”, line 9, in
    load_entry_point(‘frappe==4.7.0’, ‘console_scripts’, ‘frappe’)()
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 54, in main
    return run(fn, parsed_args)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 84, in run
    out = globals().get(fn)(**args)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 68, in new_fn
    return fn(*args, **new_kwargs)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 496, in backup
    odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 142, in scheduled_backup
    odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 146, in new_backup
    delete_temp_backups(older_than=168)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 157, in delete_temp_backups
    file_list = os.listdir(get_backup_path())
    OSError: [Errno 2] No such file or directory: ‘./phr/private/backups’
    Error: None
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/cli.py”, line 38, in cli
    return bench()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 610, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 590, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 416, in invoke
    return callback(*args, **kwargs)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/cli.py”, line 169, in update
    backup_all_sites()
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/utils.py”, line 281, in backup_all_sites
    backup_site(site, bench=bench)
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/utils.py”, line 277, in backup_site
    cwd=os.path.join(bench, ‘sites’))
    File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/utils.py”, line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
    File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command ‘/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/env/bin/frappe --backup phr’ returned non-zero exit status 1

Thanks,
Saurabh

Check the folder sites/phr. Is it actually a site or some other type of folder?

-Anand.

Thanks Anand . The issue due to improper site directory structure.

After fixing this issue, bench update broke again,

(env)saurabh@indictrans-To-be-filled-by-O-E-M:~/Documents/projects/PHR/workspace/test_setup/frappe-bench$ bench update
Already up-to-date.
From https://github.com/pawaranand/phr

  • branch master -> FETCH_HEAD
    Already up-to-date.
    From https://github.com/frappe/erpnext
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    From https://github.com/frappe/frappe
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    database backup taken - ./test_phr/private/backups/20141222_53056644_database.sql.gz - on 2014-12-22 11:34:39.630872

Running latest for test_phr

Updating frappe : [========================================]
Updating phr : [========================================]
Traceback (most recent call last):
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/env/bin/frappe”, line 9, in
load_entry_point(‘frappe==4.7.0’, ‘console_scripts’, ‘frappe’)()
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 40, in main
ret = run(fn, args)
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 84, in run
out = globals().get(fn)(**args)
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 68, in new_fn
return fn(*args, **new_kwargs)
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 441, in latest
build_website()
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 68, in new_fn
return fn(*args, **new_kwargs)
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/cli.py”, line 583, in build_website
render.clear_cache()
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/website/render.py”, line 172, in clear_cache
clear_sitemap()
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/website/router.py”, line 90, in clear_sitemap
for p in get_pages():
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/apps/frappe/frappe/website/router.py”, line 133, in get_pages
page_name, extn = fname.rsplit(".", 1)
ValueError: need more than 1 value to unpack
Error: None
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/cli.py”, line 38, in cli
return bench()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 610, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 590, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 936, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 782, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 416, in invoke
return callback(*args, **kwargs)
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/cli.py”, line 170, in update
patch_sites()
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/utils.py”, line 91, in patch_sites
exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, ‘sites’))
File “/home/saurabh/Documents/projects/PHR/workspace/test_setup/bench-repo/bench/utils.py”, line 61, in exec_cmd
subprocess.check_call(cmd, cwd=cwd, shell=True)
File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘/home/saurabh/Documents/projects/PHR/workspace/test_setup/frappe-bench/env/bin/frappe --latest all’ returned non-zero exit status 1

Regards,
Saurabh

Check that your app’s templates/pages folder does not have a folder in it. Else fix the code to exclude folders and send us a pull request :smile:

thanks,
Anand.