import os html_path = 'e:/Deepfake/deepfake_detector/templates/index.html' with open(html_path, 'r', encoding='utf-8') as f: content = f.read() # Find 'm=' again to get context for 'a' m_idx = content.find('m=H.useCallback(') if m_idx != -1: # Search backwards for "a=" or for where "a" is defined in the destructuring # Usually it's something like [l, a] = H.useState(null) search_area = content[max(0, m_idx - 5000):m_idx] print(f"Searching for 'a' definition before index {m_idx}") print(f"Context before m: {search_area[-500:]}") else: print("m= not found")