This is a quick note on how I was able to use pdb with my first dabo app in Windows.
I opened a Windows command prompt or terminal, changed directory to my app, and invoked ClassDesigner:
- python ..\ide\ClassDesigner.py addressbook.py
- (note: it has to be python not pythonw)
Using the Editing window of ClassDesigner, I inserted dabo.trace() in the code where I would like pdb to pause the execution of my app:
- (ff is a snippet of my print button code)
- nameDS = self.Form.PrimaryBizobj?.getDataSet()
- phoneDS = self.Form.getBizobj(dataSource="tblphone").getDataSet()
- dabo.trace()
- ds = nameDS.execute("select dataset.fullname, curPhone.infotext from dataset inner join curPhone on dataset.pkseq = curPhone.fkname", cursorDict="{
curPhone: phoneDS}")
In ClassDesigner, I opened a console by clicking File->Command Window (or by pressing Control-D.
I ran my app (Ctrl-Shift-R), and when I hit the print button of my app, the dabo.trace w/c I inserted in the code, activated pdb. Pdb outputted some debugging info at the Windows terminal and the ClassDesigner console now shows:
- >>> (Pdb)
From here I am able to issue the debugging commands mentioned in http://dabodev.com/wiki/Pdb or in http://docs.python.org/library/pdb.html#debugger-commands.
- (try the ff in the ClassDesigner console, output will be displayed in the Windows terminal)
- l
- n
- c
It is as simple as that. Have a nice day!
-- by bopols --