[Grok-dev] Howto set up post-mortem debugging in Grok

Sebastian Ware sebastian at urbantalk.se
Fri Aug 17 08:03:43 EDT 2007


*** 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

17 aug 2007 kl. 13.35 skrev Sebastian Ware:

> This is so easy, it is very difficult to find any simple  
> documentation... thus easy enough for me to contribute :) This  
> section should be part of a "Grok Debugging Howto"...
>
> *** 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 parts/instance/etc/zope.conf search for  
> "PostmortemDebuggingHTTP" uncomment the following lines:
>
>   <server>
>      type PostmortemDebuggingHTTP
>      address 9000
>   </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
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list