Karrigell Documentation

Version 2.2.1 13 12 05

Français

6. Debugging

6.1 Debug mode

When you are testing new versions of a program, there is often the case when you change a module which is imported by your scripts. For performance reasons, the standard Python interpreter uses the compiled versions of the modules which have been imported, and does not check if the source has been modified

You can set the debug option in the configuration file to 1, to force the reloading of the modules whose source code has been modified since they were last used

Once the program works, you can set the debug mode to 0

6.2 Error handling and debugging

If an error happens when calling an URL, a trace is displayed in the browser

The information provided consists of :

  • the url called
  • a table showing the script where the error happened : it may not be the script whose name matches the url, in case the error occured in a script included with the Include() function. If so, the arborescence of inclusions is shown. The table shows the script name, the exception name, the line number and the line text in the erroneous script
  • the raw Python traceback
  • a button "Debug"
For instance :

Error in /demo/errors/ErrorInIncludedTest1.py

/demo/errors/ErrorInIncludedTest1.py
 includes /demo/errors/ErrorInIncludedTest2.py
Script /demo/errors/ErrorInIncludedTest1.py
NameError: name 'bonjour' is not defined Line 1     print 'Script 1'
Traceback (most recent call last):
  File "C:\cygwin\home\Karrigell\Template.py", line 153, in render
    exec self.pythonCode() in ns
  File "<string>", line 1, in ?
NameError: name 'bonjour' is not defined
With this "Debug" button you access more information about the error :
  • the source code, with colored syntax and the line where the error occured hightlighted
  • a view of the environement, which you can browse to find the value of variables, the source code of functions and methods, etc

Snapshot :