Bench clear-cache giving error

Hi,
While I was trying to set a developer-mode on in site-config.json, when I run bench clear-cache command , I get the following error -

bench clear-cache
Traceback (most recent call last):
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
“main”, fname, loader, pkg_name)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 32, in clear_cache
for site in context.sites:

I even tried bench update which was successful but running this command after bench update does not help me either.

That doesn’t look like the full traceback. Can you make sure you copy all of it?

$ bench clear-cache
Traceback (most recent call last):
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
“main”, fname, loader, pkg_name)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/Users/truptimali/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/Users/truptimali/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 32, in clear_cache
for site in context.sites:
TypeError: ‘NoneType’ object is not iterable

Hi,
I have the same error, how you solve it ?

Looks like you don’t have a currentsite.txt file in your sites folder.

Use bench use your-site-name to create currentsite.txt file. And then try bench clear-cache. Alternatively, you can also use bench --site your-site-name clear-cache.

Im setting up in an multi-tenant environment, kindly advise if currentsite.txt is needed…

bench --site all clear-cache to clear cache for all the sites.

&

bench --site site-name clear-cache to clear cache for a particular site.