Guide to using g.pdb()

20 views
Skip to first unread message

lewis

unread,
Jan 25, 2018, 11:19:12 PM1/25/18
to leo-editor
Hi Edward,

I have tried to use g.pdb() to see errors when loading a plugin. I followed your advice:
"When investigating plugins, I insert a call to g.pdb() right after

import leo.core.leoGlobals as g

I then run Leo in a console with the plugin enabled. The debugger will stop early as the plugin is imported,
and I can single-step to see why the import is failing."

In the geotag.py plugin I added g.pdb()

import leo.core.leoGlobals as g
g.pdb()


But when I start Leo it is stuck with cursor showing (Pdb).

Leo 5.6, build 20180125190418, Thu Jan 25 19:04:18 CST 2018
Git repo info: branch = master, commit = 2f13cde67627
Python 3.6.4, PyQt version 5.10.0
Windows 10 AMD64 (build 10.0.16299) SP0
** isPython3: True
** caching enabled

--Return--
> n:\git\leo-editor\leo\core\leoglobals.py(1836)pdb()->None
-> pdb.set_trace()
(Pdb)
(Pdb)
(Pdb)


Can you explain how the single-step process works?

I tried return but this just repeats (Pdb)
All I could do was quit with q! twice. This seemed to unlock and allow Leo to load with message:
(Pdb) q!
loadOnePlugin: can not load enabled plugin: leo.plugins.geotag

Thanks
Lewis

Edward K. Ream

unread,
Jan 26, 2018, 8:18:19 AM1/26/18
to leo-editor
On Thu, Jan 25, 2018 at 10:19 PM, lewis <lewi...@operamail.com> wrote:

In the geotag.py plugin I added g.pdb()

import leo.core.leoGlobals as g
g.pdb()


But when I start Leo it is stuck with cursor showing (Pdb).

​Good start ;-) This section of the pdb docs shows you the pdb commands.  The most important:

c: continue execution (until the next break point)
n: execute the next line, stepping over function calls.
s: execute the next line, stepping into function calls.
l: (ell, not one) list lines around the present line.
p <expression>: print the value of the expression.

You can use the up and down arrows to see previous pdb commands.

Edward
Reply all
Reply to author
Forward
0 new messages