[Zope] Re: ZOPE Python edit debug cycle

Chui Tey teyc@bigfoot.com
Wed, 30 Aug 2000 06:52:47 +1000


"Phlip" <phlip_cpp@my-deja.com> wrote in message
news:8oefpc$ve8$1@nnrp1.deja.com...
> Newsgroupies.
>
> I installed ZOPE on Win32, and noticed it came with a bunch of
> "Products"; each a kind of "soft driver" written in some language
> (typically Python) to drive the ZObject space & build Web pages.
>
> Then I tried to edit a py file and see the new output. I had to use
> this sequence to see my tiny change:
>
>     make the change
>     save the change
>     Stop the ZOPE service
>     Start the ZOPE service
>     Refresh the ZOPE Web page
>     Inspect the change.
>
> If I had a syntax error, ZOPE throws it away and I never get to read
> it.
>

Tips:
#1. Start with -D option
#2. Use the PythonWin to run your changes through a tab nanny. (Side note:
edit.com messes up the tabs in the python code badly, use notepad if you
really have to), before restarting.
#3. Run from command line instead of a service
#4. just before where you changed the python code, insert
      import pdb
      pdb.set_trace()
      Have a look through the python debugger docos if you're not familiar.
This way you can step through your code.
      Setting breakpoints? download the latest pdb.py/bdb.py from
sourceforge, otherwise setting breakpoints is hard.
#5. you might be able to reload modules if your changes are small.

> The inner question: How, in ZOPE land, do you ask it to refresh its
> concepts of all the Python files without stopping and restarting the
> service?
>
> The outer question: What does a healthy edit/debug cycle look
> like?
>

#1. Get as much of your code working without Zope first.
#2. Fix as much code as you can before restarting. With Zope, really you
lose a lot of the interactivity in debugging code the python way.

> --
>  Phlip
> ======= http://users.deltanet.com/~tegan/home.html =======
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

I've copied this in to the Zope.org mailing list. See you there!