75: #line 97 "process_frame.ipk"
76: def py_exec(self,py,file,count,dict):
77:
78: try:
79: if 'script' in self.trace: print 'Executing',py
80: code = compile(py,file + "[%2d]" % count,'exec')
81: exec code in dict,dict
82: except KeyboardInterrupt:
83: self.update_files = 0
84: raise process_fault,'Keyboard Interrupt'
85: except eoi: raise
86: except process_fault: raise
87: except:
88: print '-------------------------------------'
89: print 'ERROR EXECUTING CLIENT PYTHON SCRIPT'
90: fileid = file+'[%2d]' % count
91: print 'CONTEXT'
92: print 'File:', fileid
93: code_lines = string.split(py,'\n')
94: i = 1
95: for line in code_lines:
96: print ' %2d:' % i,line
97: i = i + 1
98:
99: print 'TRACEBACK (innermost last)'
100: exc_type, exc_value, exc_traceback = sys.exc_info()
101: tr = traceback.extract_tb(exc_traceback)
102: for filename, lineno, function, line in tr:
103: if function != '?': location= function
104: else: location= 'mainline'
105: print ' File:',filename,'[%2d]'%lineno,'in',location
106: if line: print ' ->',line
107: elif fileid== filename:
108: print ' +>',code_lines[lineno-1]
109:
110: print 'EXCEPTION:',
111: exc_desc=traceback.format_exception_only(exc_type, exc_value)
112: lines = string.split(string.join(exc_desc,'\n'),'\n')
113: lines = filter(None, lines)
114: if len(lines)!=1:
115: print
116: for line in lines:
117: if line: print ' ',line
118: else: print ' ',lines[0]
119:
120: del exc_type, exc_value, exc_traceback
121: try: raise eoi
122: except: pass
123:
124: if self.break_on_error:
125: self.update_files = 0
126: print 'BREAKING ON ERROR'
127: print '-------------------------------------'
128: raise process_fault,'Unexpected Exception'
129: else:
130: print 'IGNORING ERROR, CONTINUING'
131: print '-------------------------------------'
132: