RE: [Zope] Help Debugging External Methods
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
Robert_J_Roberts@rl.gov wrote:
I'm not sure what you are referring to with "...the Python debugger "pdb"...". I've never used it.
The Debugger is your friend http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
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
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tue, Oct 17, 2000 at 09:05:29PM -0700, Kapil Thangavelu wrote:
The Debugger is your friend http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend
That's a useful page -- thanks for the link. It's interesting that the example fooMethod() function has a major flaw, contrary to what the HowTo says: "There's actually nothing wrong with this method to debug". I would have replied directly to the author, 'michel', but his email address does not appear on that HowTo page or any of the pages that I scanned under http://www.zope.org/Members/michel. -- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
.... the Python debugger "pdb".... It's a Python module used to debug Python programs. It can set breakpoints, single step and print expressions. It is activated automatically, when you start "ZPublisher/Test.py" with the "-D" option. Usually, I do not use it this way, however, as it takes too long, before I reach the interesting point. Instead, I use: import pdb; pdb.set_trace() at the point in Python code, where I want to get control. Then I use "Test.py" without "-D". Dieter
participants (4)
-
Dieter Maurer -
Fred Yankowski -
Kapil Thangavelu -
Robert_J_Roberts@rl.gov