Why is this error occurring when I give bench restart. the previous thing was I was installing erpnext after that I had to restart and I am getting this.
Hi @Thaya_Govzig:
bench restart
just works in production environment âŚ
If your bench is running, stop in console with Ctrl+c ⌠Maybe you closed your console and running bench is not âvisibleâ. Take a look here:
Hope this helps.
Looks like theyâre in production. That script on the previous answer is for development.
This is most likely a permission issue or just bad config
Try redoing the production setup
sudo bench setup production yourusername
You can run it twice to be sure
Hi @adam26d:
My answer is based on previous @Thaya_Govzig topic thread (When bench start is given this shows - #7 by Thaya_Govzig) so I guess they are not still in production I donât really know.
I think bench restart
causes exactly this error if you try it in development mode.
Btw, seems you are the creator of stop.py . Many thanks, made my day every day
It was a community effort that keeps giving
whatâs the reason for this
Installing erpnextâŚ
An error occurred while installing erpnext: (âModule Defâ, âAccountsâ, IntegrityError(1062, âDuplicate entry âAccountsâ for key âPRIMARYââ))
Traceback (most recent call last):
File âapps/frappe/frappe/model/base_document.pyâ, line 532, in db_insert
frappe.db.sql(
File âapps/frappe/frappe/database/database.pyâ, line 217, in sql
self._cursor.execute(query, values)
File âenv/lib/python3.11/site-packages/pymysql/cursors.pyâ, line 153, in execute
result = self._query(query)
^^^^^^^^^^^^^^^^^^
File âenv/lib/python3.11/site-packages/pymysql/cursors.pyâ, line 322, in _query
conn.query(q)
File âenv/lib/python3.11/site-packages/pymysql/connections.pyâ, line 558, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âenv/lib/python3.11/site-packages/pymysql/connections.pyâ, line 822, in _read_query_result
result.read()
File âenv/lib/python3.11/site-packages/pymysql/connections.pyâ, line 1200, in read
first_packet = self.connection._read_packet()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File âenv/lib/python3.11/site-packages/pymysql/connections.pyâ, line 772, in _read_packet
packet.raise_for_error()
File âenv/lib/python3.11/site-packages/pymysql/protocol.pyâ, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File âenv/lib/python3.11/site-packages/pymysql/err.pyâ, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1062, âDuplicate entry âAccountsâ for key âPRIMARYââ)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File âapps/frappe/frappe/commands/site.pyâ, line 462, in install_app
_install_app(app, verbose=context.verbose, force=force)
File âapps/frappe/frappe/installer.pyâ, line 294, in install_app
add_module_defs(name, ignore_if_duplicate=force)
File âapps/frappe/frappe/installer.pyâ, line 633, in add_module_defs
d.insert(ignore_permissions=True, ignore_if_duplicate=ignore_if_duplicate)
File âapps/frappe/frappe/model/document.pyâ, line 295, in insert
self.db_insert(ignore_if_duplicate=ignore_if_duplicate)
File âapps/frappe/frappe/model/base_document.pyâ, line 559, in db_insert
raise frappe.DuplicateEntryError(self.doctype, self.name, e)
frappe.exceptions.DuplicateEntryError: (âModule Defâ, âAccountsâ, IntegrityError(1062, âDuplicate entry âAccountsâ for key âPRIMARYââ))
when I use the command " Bench -site yoursitename.com install-app erpnext
Hi @Thaya_Govzig:
This happened because your previous app installation process has not been finished properly.
Check this video from Geoffrey Karani:
Please open separate topic for this question next time
Hope this helps.