Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import os
|
2 |
import re
|
3 |
import random
|
4 |
from http import HTTPStatus
|
@@ -22,14 +21,28 @@ import string
|
|
22 |
import random
|
23 |
import requests # Additional import statement
|
24 |
|
25 |
-
import
|
|
|
|
|
|
|
|
|
26 |
script_repr = os.getenv("APP")
|
27 |
if script_repr is None:
|
28 |
print("Error: Environment variable 'APP' not set.")
|
29 |
sys.exit(1)
|
30 |
|
31 |
try:
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
except Exception as e:
|
34 |
print(f"Error executing script: {e}")
|
|
|
|
|
|
|
35 |
sys.exit(1)
|
|
|
|
|
1 |
import re
|
2 |
import random
|
3 |
from http import HTTPStatus
|
|
|
21 |
import random
|
22 |
import requests # Additional import statement
|
23 |
|
24 |
+
import os
|
25 |
+
import sys
|
26 |
+
import ast # ์ถ๊ฐ ์ฝ์
|
27 |
+
|
28 |
+
# ํ๊ฒฝ ๋ณ์์์ ์คํฌ๋ฆฝํธ ๊ฐ์ ธ์ค๊ธฐ
|
29 |
script_repr = os.getenv("APP")
|
30 |
if script_repr is None:
|
31 |
print("Error: Environment variable 'APP' not set.")
|
32 |
sys.exit(1)
|
33 |
|
34 |
try:
|
35 |
+
# ๋ฌธ์์ด๋ก ๋ ์คํฌ๋ฆฝํธ๋ฅผ ์ปดํ์ผํ๊ณ ์คํ
|
36 |
+
compiled_code = compile(script_repr, '<string>', 'exec')
|
37 |
+
# ์ ์ญ ๋ฐ ์ง์ญ ๋ค์์คํ์ด์ค ์ ์
|
38 |
+
globals_dict = globals()
|
39 |
+
locals_dict = {}
|
40 |
+
|
41 |
+
# ์ปดํ์ผ๋ ์ฝ๋ ์คํ
|
42 |
+
exec(compiled_code, globals_dict, locals_dict)
|
43 |
except Exception as e:
|
44 |
print(f"Error executing script: {e}")
|
45 |
+
# ์ค๋ฅ ์ ๋ณด ๋ ์์ธํ ์ถ๋ ฅ
|
46 |
+
import traceback
|
47 |
+
traceback.print_exc()
|
48 |
sys.exit(1)
|