Hi, guys!
I am trying to setup my Visual Code as the debugger for frappe but had a roadblock for a week and a half now. I am trying to debug this code to test the frappe.db.sql cmd:
import frappe
@frappe.whitelist()
def queryDB():
print('test')
checkSQL = frappe.db.sql("""SELECT name FROM `tabDelivery Note`""", as_dict=True)
print(checkSQL)
print('test end')
queryDB()
but I am having this output and error after running the debug:
test
Traceback (most recent call last):
File β/home/seanmarkmira/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.pyβ, line 72, in getattr
return self.storage[self.ident_func()][name]
KeyError: 139818003855168
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File β/home/seanmarkmira/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.pyβ, line 309, in _get_current_object
return getattr(self.__local, self.name)
File β/home/seanmarkmira/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.pyβ, line 74, in getattr
raise AttributeError(name)
AttributeError: db
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File β/home/seanmarkmira/frappe-bench/apps/x_app/x_app/x_app/doctype/expected_return/testDB.pyβ, line 11, in
queryDB()
File β/home/seanmarkmira/frappe-bench/apps/x_app/x_app/x_app/doctype/expected_return/testDB.pyβ, line 7, in queryDB
checkSQL = frappe.db.sql(βββSELECT name FROM tabDelivery Note
βββ, as_dict=True)
File β/home/seanmarkmira/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.pyβ, line 348, in getattr
return getattr(self._get_current_object(), name)
File β/home/seanmarkmira/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.pyβ, line 311, in _get_current_object
raise RuntimeError(βno object bound to %sβ % self.name)
RuntimeError: no object bound to dbβ
I already followed this setup for VS Code. Already updated the program, pythonpath, and CWD. Still having problems with this. How to fix this problem? Any help would be highly appreciated.