Bench Update/bad json

Im trying to run Bench Update, and receiving the following error, I did customise the Purchase Order form, but when I received this error, so copied the original once from the source VM back, but still get this error.

]bad json: /home/frappe/frappe-bench/apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.json
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 call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/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 “/home/frappe/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 “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
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 invoke
return callback(*args, **kwargs)
File “/home/frappe/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/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 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 32, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 44, in sync_for
import_file_by_path(doc_path, force=force, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 38, in import_file_by_path
docs = read_doc_from_file(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 77, in read_doc_from_file
doc = json.loads(f.read())
File “/usr/lib/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
obj, end = self.scan_once(s, idx)

Any help greatly appreicated.

Thanks

Jason

@jason.hunter that is because a issue in bench tool, that if it dont find a “common_site_config.json” in your site path, it create and blank json file, and a blank json file, is not a valid json file :smile:

Just copy the common_site_config.json from a fresh bench or put this in your common_site_config.json

{
 "auto_update": false,
 "background_workers": 1,
 "frappe_user": "frappe",
 "gunicorn_workers": 1,
 "rebase_on_pull": false,
 "redis_cache": "redis://localhost:13000",
 "redis_queue": "redis://localhost:11000",
 "redis_socketio": "redis://localhost:12000",
 "restart_supervisor_on_update": false,
 "serve_default_site": true,
 "shallow_clone": true,
 "socketio_port": 9000,
 "update_bench_on_update": true,
 "webserver_port": 8000
}

ensure that all ports are free or are the same that you already use for this instalation

Hi thanks for your update. I have applied your suggestion, bu it has made not differnce, my issue seems to be related to:
purchase_order.json

Any further ideas?

Thanks

Resovled by copying the orignal sourcce purchase_order,json file and running bench update again