Upload 3 files
Browse files
app.py
CHANGED
|
@@ -23,10 +23,17 @@ try:
|
|
| 23 |
# Add to path and execute the downloaded app
|
| 24 |
sys.path.insert(0, str(CACHE_DIR))
|
| 25 |
|
| 26 |
-
# Execute the app.py file directly
|
| 27 |
app_path = CACHE_DIR / "app.py"
|
| 28 |
with open(app_path) as f:
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
except Exception as e:
|
| 32 |
# Show professional error page if loading fails
|
|
|
|
| 23 |
# Add to path and execute the downloaded app
|
| 24 |
sys.path.insert(0, str(CACHE_DIR))
|
| 25 |
|
| 26 |
+
# Execute the app.py file directly with proper globals
|
| 27 |
app_path = CACHE_DIR / "app.py"
|
| 28 |
with open(app_path) as f:
|
| 29 |
+
code = f.read()
|
| 30 |
+
# Provide all necessary globals including __file__
|
| 31 |
+
exec_globals = {
|
| 32 |
+
"__name__": "__main__",
|
| 33 |
+
"__file__": str(app_path),
|
| 34 |
+
"__builtins__": __builtins__
|
| 35 |
+
}
|
| 36 |
+
exec(code, exec_globals)
|
| 37 |
|
| 38 |
except Exception as e:
|
| 39 |
# Show professional error page if loading fails
|