Error while trying to run Bench Update

When I try updating bench I get the following traceback:

  File "/usr/bin/bench", line 9, in <module>
    load_entry_point('bench==0.92', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 26, in update
    deprecate_old_config(".")
  File "/home/frappe/bench-repo/bench/config/common_site_config.py", line 125, in deprecate_old_config
    os.remove(bench_config_path)
OSError: [Errno 13] Permission denied: './config.json'

How can I resolve this?

Thank you!

@Tanuj

Looks like while updating the bench, it creates a common_site_config.json and removes the site_config.json.

In your case, it seems file was not deleted due to permission issues.

Strange! Never happened before.

Any help on how I can fix it?
Chmod 777?

Thanks!

+1 I have the same error…

bitnami@XXX:~/apps/erpnext/htdocs/frappe-bench$ bench update
Traceback (most recent call last):
  File "/opt/bitnami/apps/erpnext/htdocs/venv/bin/bench", line 9, in <module>
    load_entry_point('bench==0.92', 'console_scripts', 'bench')()
  File "/opt/bitnami/apps/erpnext/htdocs/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/bitnami/apps/erpnext/htdocs/venv/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/opt/bitnami/apps/erpnext/htdocs/bench-repo/bench/commands/update.py", line 26, in update
    deprecate_old_config(".")
  File "/opt/bitnami/apps/erpnext/htdocs/bench-repo/bench/config/common_site_config.py", line 122, in deprecate_old_config
    put_config(common_site_config, bench_path)
  File "/opt/bitnami/apps/erpnext/htdocs/bench-repo/bench/config/common_site_config.py", line 38, in put_config
    with open(config_path, 'w') as f:
IOError: [Errno 13] Permission denied: './sites/common_site_config.json'

@diegoscl

Try chmod 755 on your frappe user folder. Worked for me.

chmod 755 /home/{user}

what is your ‘pwd’ (present working directory) ??

got this error when I tried firing bench command when my pwd was /root instead of /home/frappe