#NEWLINE# def findFrame( thread_id , frame_id ) : #NEWLINE# #INDENT# ' returns a frame on the thread that has a given frame_id ' #NEWLINE# if ( thread_id != GetThreadId ( threading . currentThread ( ) ) ) : #NEWLINE# #INDENT# raise VariableError ( 'findFrame: must execute on same thread' ) #NEWLINE# #UNINDENT# lookingFor = int ( frame_id ) #NEWLINE# if AdditionalFramesContainer . additional_frames : #NEWLINE# #INDENT# if DictContains ( AdditionalFramesContainer . additional_frames , thread_id ) : #NEWLINE# #INDENT# frame = AdditionalFramesContainer . additional_frames [ thread_id ] . get ( lookingFor ) #NEWLINE# if ( errMsg is not None ) : #NEWLINE# #INDENT# return frame #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# curFrame = GetFrame ( ) #NEWLINE# if ( frame_id == '*' ) : #NEWLINE# #INDENT# return curFrame #NEWLINE# #UNINDENT# frameFound = None #NEWLINE# for frame in iterFrames ( curFrame ) : #NEWLINE# #INDENT# if ( lookingFor == id ( frame ) ) : #NEWLINE# #INDENT# frameFound = frame #NEWLINE# del frame #NEWLINE# break #NEWLINE# #UNINDENT# del frame #NEWLINE# #UNINDENT# del curFrame #NEWLINE# if ( frameFound is None ) : #NEWLINE# #INDENT# msgFrames = '' #NEWLINE# i = 0 #NEWLINE# for frame in iterFrames ( GetFrame ( ) ) : #NEWLINE# #INDENT# i += 1 #NEWLINE# msgFrames += str ( id ( frame ) ) #NEWLINE# if ( ( i % 5 ) == 0 ) : #NEWLINE# #INDENT# msgFrames += '\n' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msgFrames += '  -  ' #NEWLINE# #UNINDENT# #UNINDENT# errMsg = ( 'findFrame: frame not found.\nLooking for thread_id:%s, frame_id:%s\nCurrent     thread_id:%s, available frames:\n%s\n' % ( thread_id , lookingFor , GetThreadId ( threading . currentThread ( ) ) , msgFrames ) ) #NEWLINE# raise FrameNotFoundError ( errMsg ) #NEWLINE# #UNINDENT# return frameFound