Access REPL shell for frappe

Can we get access to RELP shell for frappe?

I tried the following.

  1. Add all apps and site packages path to PYTHONPATH env var and export it.


  1. Open ipython shell

  2. exec from import get_party_account as i need to try it in RELP shell.

  3. I got error as stated below.

get_party_account(“Arun Logistics”, “IOCL - AL”, “Supplier”)

RuntimeError Traceback (most recent call last)
in ()
----> 1 get_party_account(“Arun Logistics”, “IOCL - AL”, “Supplier”)

/home/erpnext/frappe-bench/apps/erpnext/erpnext/accounts/party.pyc in get_party_account(company, party, party_type)
135 if party:
→ 136 acc_head = frappe.db.get_value(“Account”, {“master_name”:party,
137 “master_type”: party_type, “company”: company})

/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.pyc in getattr(self, name)
336 if name == ‘members’:
337 return dir(self._get_current_object())
→ 338 return getattr(self._get_current_object(), name)
340 def setitem(self, key, value):

/home/erpnext/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.pyc in _get_current_object(self)
299 return getattr(self.__local,
300 except AttributeError:
→ 301 raise RuntimeError(‘no object bound to %s’ %
303 @property

RuntimeError: no object bound to db

How can i init env so that we can try stuff out in RELP shell?


There a command for that
bench frappe --ipython

(Will select the default site )

Thanks mate, worked like charm :slight_smile:

This command does not work for me:

 os.execv(f, [f] + sys.argv[2:])
OSError: [Errno 2] No such file or directory

Use bench console

Thanks, yeah the new one is called bench console