Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Members / jhb / old blog entries / debugging_zope_ipython

debugging_zope_ipython

by Jörg Baach last modified Apr 21, 2006 01:51 PM
how to get a decent debugging environment

As written elsewhere (http://zopewiki.org/ZEO), you can setup zope to
use zeo, and then start a debugging session with

zopectl debug

Problem: you get only a very limited shell.

Solution:

* Install ipython
* Modifiy one single line of zopectl:

*** Zope-2.8.5-final/lib/python/Zope2/Startup/zopectl.py 2005-12-19 08:25:56.000000000 +0100
--- ../zope/Zope-2.8.5/lib/python/Zope2/Startup/zopectl.py 2006-02-12 19:16:20.000000000 +0100
***************
*** 167,169 ****
def do_debug(self, arg):
! cmdline = self.get_startup_cmd(self.options.python + ' -i',
'import Zope2; app=Zope2.app()')
--- 167,170 ----
def do_debug(self, arg):
! #cmdline = self.get_startup_cmd(self.options.python + ' -i',
! cmdline = self.get_startup_cmd('/usr/bin/ipython -i',
'import Zope2; app=Zope2.app()')

run

.../zopectl/debug

Use tab completion, code insight etc.

Thanks to tav for this!

Addition:
Put ModuleSecurityInfo('pdb').declarePublic('set_trace') somewhere in a
Module
Put into some ttw code (python):

from pdb import set_trace
set_trace()

Start ipython in debug mode
Type

Zope2.debug('/hello',d=1,u='joerg:baach')

(Debugging the url /hello, using the username and password)
You are in pdb

Goto
http://www.zope.org/Members/klm/ZopeDebugging/ConversingWithZope
http://zopewiki.org/DebuggingWithPdb
http://www.zope.org/Documentation/Books/ZDG/current/TestingAndDebugging.stx
http://docs.python.org/lib/debugger-commands.html

and tell me what to do with it ;-)

From #zope.de

14:52 < TinoW> do3cc: zopectl debug -> import Zope,pdb ->
pdb.runeval('Zope.debug("/pfad/zum/object?blah=foo")',globals(),locals())

Add comment

You can add a comment by filling out the form below. Plain text formatting.

Question: What is 42 minus 19?
Your answer: