Hi
Migration from V12 to 13 went well. But once completed, and trying to submit any document I am getting this error “ModuleNotFoundError: No module named ‘frappe.core.api’” on the web interface. Could not find any help online. Anyone please help.
Hi
Migration from V12 to 13 went well. But once completed, and trying to submit any document I am getting this error “ModuleNotFoundError: No module named ‘frappe.core.api’” on the web interface. Could not find any help online. Anyone please help.
Hi,
May we know how the migration was performed? Steps and commands?
Long process short story:
Anyone encountered this error, please help.
In general, to update to a new version , one may use the steps found here:
https://discuss.frappe.io/t/release-notes-erpnext-version-13-has-been-released/73471
bench switch-to-branch version-13 frappe erpnext --upgrade bench update bench build
There may be other steps or options to the above commands that will help as well, for example bench update --patch .
@smino, thank you for the guide.
Unfortunately these didn’t work. All of the above mentioned did run without any errors. Still having the same issue.
There are no errors captured in the logs during submitting any docs (Quotation, Sales Invoice or any other docs.) Only error pops up is in the web page itself
The detailed error copied from web page is below:
{
"erpnext": "13.46.1",
"frappe": "13.49.2",
"ksa_vat": "0.0.1",
"pdf_on_submit": "13.2"
}
Form/Sales Invoice/CBX-SINV-00517
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 69, in application
response = frappe.api.handle()
File "apps/frappe/frappe/api.py", line 55, in handle
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 38, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/__init__.py", line 1473, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
doc.submit()
File "apps/frappe/frappe/model/document.py", line 1020, in submit
return self._submit()
File "apps/frappe/frappe/model/document.py", line 1009, in _submit
return self.save()
File "apps/frappe/frappe/model/document.py", line 312, in save
return self._save(*args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 366, in _save
self.run_post_save_methods()
File "apps/frappe/frappe/model/document.py", line 1090, in run_post_save_methods
self.run_method("on_submit")
File "apps/frappe/frappe/model/document.py", line 943, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "apps/frappe/frappe/model/document.py", line 1261, in composer
hooks.append(frappe.get_attr(handler))
File "apps/frappe/frappe/__init__.py", line 1463, in get_attr
return getattr(get_module(modulename), methodname)
File "apps/frappe/frappe/__init__.py", line 1205, in get_module
return importlib.import_module(modulename)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "apps/pdf_on_submit/pdf_on_submit/attach_pdf.py", line 22, in <module>
from frappe.core.api.file import create_new_folder
ModuleNotFoundError: No module named 'frappe.core.api'
{
"type": "POST",
"args": {
"doc": "{\"name\":\"CBX-SINV-00517\",\
.....
.....
.....
"invoice_portion\":100,\"discount\":0,\"payment_amount\":402.5,\"outstanding\":402.5,\"paid_amount\":0,\"discounted_amount\":0,\"base_payment_amount\":402.5,\"doctype\":\"Payment Schedule\"}],\"payments\":[],\"sales_team\":[],\"__onload\":{\"make_payment_via_journal_entry\":0}}",
"action": "Submit"
},
"btn": {
"jQuery224082625244169196481": {
"events": {
"click": [
{
"type": "click",
"origType": "click",
"guid": 3557,
"namespace": ""
}
]
}
}
},
"freeze": true,
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.desk.form.save.savedocs"
}
{
"exception": "ModuleNotFoundError: No module named 'frappe.core.api'"
}
Can you post the contents of the site_config.json of your ERPNext site?
Does bench setup requirements
complete without error?
Yes, “bench setup requirements” did run without any errors.
bench setup requirements
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Installing 5 applications...
Installing frappe
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe
$ yarn install
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
$ yarn run snyk-protect
yarn run v1.22.19
$ snyk protect
⚠ WARNING: Snyk protect was removed at 31 March 2022.
Please use '@snyk/protect' package instead: https://updates.snyk.io/snyk-wizard-and-snyk-protect-removal-224137
Done in 6.02s.
Done in 7.53s.
Installing pdf_on_submit
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/pdf_on_submit
Installing erpnext
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/erpnext
$ yarn install
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.15s.
Installing payments
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/payments
Installing ksa_vat
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/ksa_vat
/home/frappe/frappe-bench/sites/xx/site_config.json
{
"db_name": "_884f6bb4043000d2",
"db_password": "NMDY9gm398D0Tebq",
"db_type": "mariadb",
"encryption_key": "w-tO0c_gwq31SC_n83EcB23BvHlwE57ELb9Jxzh0JO8=",
"maintenance_mode": 0,
"host_name": "http://localhost",
"host_name": "http://192.168.50.114",
"user_type_doctype_limit": {
"employee_self_service": 10
}
}
The only other things I can think of to try are : sudo pip3 install frappe-bench --upgrade
and possibly: bench setup production username
, unless you intend to run in develop mode.
@smino, Tried both and ran successfully. Same result, with the web error.
Its very strange that it don’t give any error in the logs.
Any other thoughts???
Finally found it
It was due to the app pdf_on_submit, which was causing this error.
removed the app and restarted bench.
@smino, thanks for the support dear.
Looks like pdf_on_submit is at 13.4 , perhaps reinstalling it with the newer version will work?
I had installed pdf_on_submit long back before the KSA_VAT app released. I am not using it currently for my site.
Anyway, could give a try with a clone sometime later.