Using my odoo.sh project (v13.0.2) > EDITOR-Tab , which redirects me to mywebsite.odoo.com/odoo-sh/editor/lab, when i want to debug using import pdb; pdb.set_trace(), it raises a BdbQuit Error :
File "/usr/lib/python3.6/bdb.py", line 113, in
dispatch_exception
if self.quitting: raise BdbQuit
In the past versions : v13.0.1.xxx, i could use pdb.set_trace() to debug my python code. How to solve this issue ?
rpdb is a remote debugger based on pdb. It re-routes stdin and stdout to a socket handler, so that you can debug server processes (remotely).
In Odoo.sh > yourstagingBranch, click on the SHELL-tab:
In Odoo.sh > yourstagingBranch, click on the EDITOR-tab:
IN ODOO-EDITOR:
l(ist): Lists the lines surrounding the current line
w(here): Displays the file and line number where we currently are
s(tep): Step into the function at the current line
n(ext): Continue execution until the next line in the current function is reached or it returns. (The difference between next and step is that step stops inside a called function, while next executes called functions at (nearly) full speed, only stopping at the next line in the current function.)
a(rgs): Print the argument list of the current function
p(rint) variablename : Print value of variablename
quit : To quit rPdb
More info : https://itnext.io/debugging-your-code-in-python-pdb-vs-rpdb-e7bb918a8ac3 Official documentation (commands) : https://docs.python.org/3/library/pdb.html
#######
OR, alternatively : Using this post How to debug python CLI that takes stdin? :
in Odoo.sh>EDITOR (Jupyter Lab): Open a first Terminal and create these two fifos which will be used as stdin/stdout to use pdb :
...which makes appear a prompt cursor. Keep this Terminal Tab opened.
Write these 2 lines at the top of the Python script to be debugged :
In this Python script, call set_trace() on your customized mypdb:
...