""" Simple script to check app.py for syntax errors and identify line numbers """ import os import sys import traceback def check_file_syntax(file_path): print(f"Checking syntax for: {file_path}") try: with open(file_path, 'r', encoding='utf-8') as f: source = f.read() # Try to compile the source code compiled = compile(source, file_path, 'exec') print(f"✓ {file_path} has valid Python syntax") return True except SyntaxError as e: print(f"✗ Syntax error in {file_path}:") print(f" Line {e.lineno}, Column {e.offset}: {e.text}") print(f" {e}") return False except Exception as e: print(f"✗ Error checking {file_path}:") print(f" {e}") traceback.print_exc() return False if __name__ == "__main__": app_path = "app.py" if not os.path.exists(app_path): print(f"File not found: {app_path}") sys.exit(1) if check_file_syntax(app_path): sys.exit(0) else: sys.exit(1)