[Zope] Help Debugging External Methods

Robert_J_Roberts@rl.gov Robert_J_Roberts@rl.gov
Mon, 16 Oct 2000 09:27:48 -0700


I do pretty much the same things myself.  I assign sys.stderr = sys.stdout,
then I create my own log file object from a module I wrote a few years ago,
and then assign something like sys.stderr = self.logObj.

That works well for any errors that occur after those assignments have
occurred but doesn't do much for anything that happens earlier.

I also run the python code outside of Zope to get it all working.

It's just a pain when I have to make some minor change in the Zope to
External Method logic and it breaks.  That's where I start to lose it some
in the debugging.

Using something like:

	import sys, traceback, string
	try:
		trysomething()
	except:
		type, val, tb = sys.exc_info()
	
sys.stderr.write(string.join(traceback.format_exception(type, val, tb), ''))
		del type, val, tb

...helps, but even with that I seem to get errors that I just can't seem to
catch and report properly.

I'm not sure what you are referring to with "...the Python debugger
"pdb"...".  I've never used it.

Thanks for your help,

Robert J. Roberts
LMSI-SD&I
509.376.6343
robert_j_roberts@rl.gov



-----Original Message-----
From: Dieter Maurer [mailto:dieter@handshake.de]
Sent: Saturday, October 14, 2000 1:51 PM
To: Robert_J_Roberts@rl.gov
Cc: zope@zope.org
Subject: Re: [Zope] Help Debugging External Methods


Robert_J_Roberts@rl.gov writes:
 > What are my options for debugging External Methods in Zope running on
 > Windows NT?
I work under Unix. Maybe my technics are not applicable for NT.

Usually, I use "print" statements for debugging purposes.
Under Unix, I can redirect "stdout" to a file and
view the output (be sure to flush stdout after "print").

You can also use "zLog" (may be spelled differently!).
This writes log entries into the log file.
The advantages: will work under Windows, contains a timestamp.

If the external method does not need too many Zope infrastructure,
I test it outside of Zope and integrate only, when it works
properly.

When everything else does not work, I use "Test.py" and
the Python debugger "pdb".


Dieter