debugging python scripts
debugging python scripts
Hello, I am a beginner with Python and I don't know how to debug in Golly. I try to use pdb and pdb.set_trace() but it seems not to work.
- Andrew
- Moderator
- Posts: 1065
- Joined: June 2nd, 2009, 2:08 am
- Location: Melbourne, Australia
- Contact:
Re: debugging python scripts
I don't think it makes sense to use pdb with Golly because you won't be able to enter any pdb commands (you don't have access to a command line). If you want to see a call trace at a particular point in your script code, insert a line like this:
If you want to see the traceback info without exiting the script then do this instead:
Code: Select all
raise RuntimeError("foo")
Code: Select all
try:
raise RuntimeError("foo")
except:
import sys
import traceback
exception, msg, tb = sys.exc_info()
golly.note('\n'.join(traceback.format_exception(exception, msg, tb)))