Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
def main():
|
4 |
+
try:
|
5 |
+
# Ensure the app module is correctly named
|
6 |
+
app_module = "app"
|
7 |
+
if not os.path.exists(f"{app_module}.py"):
|
8 |
+
raise ImportError(f"Module '{app_module}' not found.")
|
9 |
+
|
10 |
+
# Ensure there are no syntax errors
|
11 |
+
with open(f"{app_module}.py", "r") as file:
|
12 |
+
code = file.read()
|
13 |
+
compile(code, f"{app_module}.py", 'exec')
|
14 |
+
|
15 |
+
# Ensure there are no import errors
|
16 |
+
import app
|
17 |
+
|
18 |
+
print("App module is correctly named, has no syntax errors, and no import errors.")
|
19 |
+
except ImportError as e:
|
20 |
+
print(f"ImportError: {e}")
|
21 |
+
except SyntaxError as e:
|
22 |
+
print(f"SyntaxError: {e}")
|
23 |
+
except Exception as e:
|
24 |
+
print(f"Error: {e}")
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
main()
|