Spaces:
Sleeping
Sleeping
Download src/gaia/utils/validate_app_simple.py from jm-vis/Final_Assignment_GAIAAgent: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/jm-vis/Final_Assignment_GAIAAgent/resolve/main/src/gaia/utils/validate_app_simple.py
- Command line
-
hf download hf://spaces/jm-vis/Final_Assignment_GAIAAgent/src/gaia/utils/validate_app_simple.py
-
curl -L -o validate_app_simple.py https://huggingface.co/spaces/jm-vis/Final_Assignment_GAIAAgent/resolve/main/src/gaia/utils/validate_app_simple.py
1.08 kB
| """ | |
| 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) |