Update app.py
Browse files
app.py
CHANGED
|
@@ -5,9 +5,14 @@ import re
|
|
| 5 |
|
| 6 |
def load_cpp_file(file):
|
| 7 |
text = file.name
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def Evaluate_Code(code, method):
|
| 13 |
if method == "No Format":
|
|
|
|
| 5 |
|
| 6 |
def load_cpp_file(file):
|
| 7 |
text = file.name
|
| 8 |
+
if file is None:
|
| 9 |
+
return ""
|
| 10 |
+
try:
|
| 11 |
+
with open(text, 'r', encoding='utf-8') as f:
|
| 12 |
+
content = f.read()
|
| 13 |
+
return content
|
| 14 |
+
except:
|
| 15 |
+
return ""
|
| 16 |
|
| 17 |
def Evaluate_Code(code, method):
|
| 18 |
if method == "No Format":
|