[Grok-dev] various balls grok has in the air (and help us catch
them)
Sebastian Ware
sebastian at urbantalk.se
Mon Sep 10 17:37:29 EDT 2007
Just reposting:
** Debugging ***
You can debug your application using the python debugger (Pdb). If
you want to explore why you are getting an unexpected exception you
are better off using post-mortem debugging (se separate topic).
1 First you have to import the pdb module
import pdb
2 Then you set a breakpoint in your code by inserting the following
line of code
pdb.set_trace()
3 Run the application from a terminal
parts/instance/bin/runzope
4 Play around with your application until the execution reaches the
breakpoint
5 In the terminal window where you started Zope you will now se the
python debugger prompt
(Pdb)
6 Check out the available commands in Pdb
http://docs.python.org/lib/debugger-commands.html
http://docs.python.org/lib/debugger-hooks.html
mvh Sebastian
*** Post-mortem Debugging ***
Post-mortem debugging allows you to explore the state of your
application once it has thrown an exception. In order to enable post-
mortem debugging:
1 in your buildout.cfg look for the zopectl section. You will see an
entry
there that defines the zope.conf that should be used. Modify that to
look like this:
zope.conf = ${data:zconfig}
<server>
type PostmortemDebuggingHTTP
address 8080
</server>
if you rerun buildout your zope.conf will be updated to use the
PostmortemDebuggingHTTP server.
2 Start Zope in a terminal
parts/instance/bin/runzope
3 Use the application up to the point of the exception
4 Trigger the post-mortem debugger by opening the following page in
your browser
http://localhost:9000/
-given server on localhost and the port in (1) set to 9000
5 In the terminal window where you started Zope you will now see the
python debugger prompt
(Pdb)
6 Check out the available commands in Pdb
http://docs.python.org/lib/debugger-commands.html
http://docs.python.org/lib/debugger-hooks.html
Mvh Sebastian (and a correction posted by Wichert)
10 sep 2007 kl. 22.51 skrev Martijn Faassen:
> * Sebastian and Wichert wrote some instructions on post-mortem
> debugging. Is there something still blocking this from appearing as a
> tutorial on our website?
More information about the Grok-dev
mailing list