Logo Search packages:      
Sourcecode: karrigell version File versions  Download package

def debugger::k_debugger::Error::__init__ (   self,
  tree,
  tb,
  exc_info,
  namespace,
  initialNs,
  key 
)

Instances are created from 
- tree : tree[0] is the script (instance of the Script class
in Template) where the error occured. If it is included in other 
scripts, the following items are its parents
- tb and exc_info : traceback elements
- initialNs : a copy of the namespace before the script ran
- namespace : a copy of the namespace after the script has run
- key : random string generated in Template

Definition at line 18 of file k_debugger.py.

00018                                                                :
        """Instances are created from 
        - tree : tree[0] is the script (instance of the Script class
        in Template) where the error occured. If it is included in other 
        scripts, the following items are its parents
        - tb and exc_info : traceback elements
        - initialNs : a copy of the namespace before the script ran
        - namespace : a copy of the namespace after the script has run
        - key : random string generated in Template""" 
        
        self.namespace={0:id(namespace),
            id(namespace):k_utils.Node(None,"namespace",namespace)}
        self.initialNs=initialNs
        self.tree=tree
        self.script=tree[-1]
        
        # browses traceback upwards
        errorLine=0
        for i in range(len(tb)):
            (filename,errorLine,x,y)=tb[len(tb)-i-1]
            if filename=="<string>":
                break
        [exc_type,exc_value]=exc_info[:2]
        if type(exc_type) == types.ClassType:
            stype = exc_type.__name__
        else:
            stype = exc_type
        if exc_type in [SyntaxError,IndentationError]:
            exc_type_value=stype
            try:
                errorMsg,(filename, lineno, offset, line) = exc_value
                errorLine=lineno
            except:
                pass
        else:
            exc_type_value=str(stype)+": "+str(exc_value)

        if self.script.lineMapping is None:
            originLineNum=errorLine-1
        else:
            try:
                originLineNum=self.script.lineMapping[errorLine-1]
            except KeyError:
                originLineNum=errorLine-1
        try:
            originErrorLine=open(self.script.name).read().split("\n")[originLineNum]
        except IndexError:
            originErrorLine= '--error fetching error origin line --' 
        self.exc_type_value=exc_type_value
        self.originLineNum=originLineNum
        self.originErrorLine=originErrorLine
        self.pythonLine=errorLine
        self.key=key
        Errors[key]=self

    def getRawTraceback(self):


Generated by  Doxygen 1.6.0   Back to index