3

I'm trying to fix bugs from gedit plugins. Gedit uses C but some of its plugins are in Python. My computer is old and I cannot run an IDE. I've read about PDB (Python Debugger), but i cannot call the plugin directly with PDB. Is it possible set breakpoints in a gedit plugin, run gedit and then use PDB to debug?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
thom
  • 33
  • 3

2 Answers2

4

You could try editing the gedit plugins that you want to debug and putting

import pdb; pdb.set_trace()

in there and that should break into the debugger. You might need to launch gedit from a command prompt instead of the GUI so that it has a terminal for pdb to run in.

Marc Abramowitz
  • 3,447
  • 3
  • 24
  • 30
  • This works for me with one change. I found that sometimes I needed to launch gedit in standalone mode ```gedit -s``` for the pdb.set_trace() to kick in. Also, you may want to remove the bytecompiled .pyc file for the file you are setting the breakpoint in, to prevent cached non breakpointed file. Also, keep in mind that, depending on your pdb, the plugin may not be loaded in yet and might appear as unchecked in Edit->Preferences->Plugins. You can type ```continue``` to have the file loaded and proceed as normal (to a possible other breakpoint you have on an event triggered function). โ€“ yuvilio Jul 31 '12 at 02:15
0

AFAIK you can't really use gedit for python debug but you can try Winpdb (archived link / SourceForge.net / Google Code Archive) which can be used in parallel with gEdit

Alternative: Fork of the official winpdb (winpdb-reborn ยท PyPI / GitHub)

drhanlau
  • 2,517
  • 2
  • 24
  • 42
  • To whom that gave a downvote to my answer, what is the problem, care to explain? โ€“ drhanlau May 21 '11 at 14:06
  • While I didn't downvote, I'd guess it was because OP already mentioned PDB, suggesting he already knows this much. He's asking for a how-to on *using* PDB inside gedit โ€“ loopbackbee Mar 30 '15 at 11:04