9 Debugging Tips

When an error is encountered while running a Python script, you normally get a traceback that shows the location in all the functions that were called. This can be very verbose, and it is often not very helpful to see the complete traceback, so by default PyRAF only shows the most relevant portion of the traceback. If you really do want to see the full traceback, however, use the .fulltraceback command directive (which can be abbreviated, e.g. .full), which prints the complete traceback from the last error encountered.

There is a verbosity attribute which controls how much information is printed to the terminal window when running a task. The setVerbose(value=1) function sets the verbosity level to the specified value. You can use print iraf.Verbose to see the current verbosity level, or if iraf.Verbose: to test it. When PyRAF is started, setVerbose(value=0) is run to initialize the value to 0. Setting it to 1 results in only slightly more output, but setting it to 2 prints information about starting, running and shutting down a task.

Questions or comments? Contact help@stsci.edu
Documented updated on