Develop-test-debug cycle

Thomas Heller theller at python.net
Wed Mar 20 09:16:33 EST 2002


"Dale Strickland-Clark" <dale at riverhall.NOTHANKS.co.uk> wrote in message news:un2h9ukh13kddcd3ooc9osejapiaf5v6t3 at 4ax.com...
> I can't believe I'm doing this this best way.
>
> I am debugging a large system written in Python with modules spread
> over 4 directories. I'm using PythonWin under Win2K to set-up the
> environment and run the code.
>
> Setting up the environment typically involves the following commands:
>
> import sys
> sys.path.append("x:\\whereever")
> from wibbleModule import wibble
> wibs = wibble(args)
>
> wibs.methods(args)
>
> <error...>
>
> At this point, I fix the error.
>
> Now, I haven't figured out a way of continueing past this point
> without quiting and starting from scratch because there appears to be
> no way to get Python to reload a module. The reload() function doesn't
> do it.
>
> I've tried stuff like this:
>
> del wibs
> reload(sys.modules['wibbleModule']
>
> but I still seem to have the old version loaded.
>
> I've also tried using PyCrust for this but it suffers from the same
> problems. I assume IDLE does too.
>
> How do others go about interactively debugging large Python OO-based
> systems?

Dave,

maybe this can help you? Comments appreciated, I didn't get much feedback!
This script spawns a thread watching changed modules, automatically
reloads them, and tries its best to update the currently running program.

http://aspn.activestate.com/ASPN/Mail/Message/907876
and note this bugfix:
http://aspn.activestate.com/ASPN/Mail/Message/907945

Thomas





More information about the Python-list mailing list