On Sat, Mar 20, 2004 at 03:21:25PM -0500, Small Business Services wrote:
From: "John Poltorak" <jp@warpix.org>
Can anyone suggest how I can include some debugging in a Python script?
I don't suppose there is any way to single-step through a program is there?
Not that I have discovered - I hope someone else can prove me wrong!
However, you can wrap your entire script in a 'try/except' and use a list variable to collect debug info along the way and then print it out.
What I was hoping for was something like the '-x' flag for shell scripts. I guess I could try using '-v' and see what happens. There is also a PYTHONVERBOSE=x variable which can be used. If anyone has experience of those I'd be interested in any advice.
Note: if you are using the 'Test' (ie. click on the Test tab while you are editing the script within the ZMI) instead of 'return debuglist' use 'print debuglist'
I can't do that since it is the Zope install script I am trying to debug...
HTH
Jonathan
-- John