Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ import os
|
|
| 4 |
import subprocess
|
| 5 |
import sys
|
| 6 |
import shutil
|
| 7 |
-
from mcstatus import JavaServer
|
| 8 |
import gradio as gr
|
| 9 |
import threading
|
| 10 |
import time
|
|
@@ -24,6 +23,17 @@ except ImportError:
|
|
| 24 |
print(f"Failed to install pyngrok: {e}")
|
| 25 |
PYNGROK_AVAILABLE = False
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
PAPER_JAR_URL = "https://fill-data.papermc.io/v1/objects/234a9b32098100c6fc116664d64e36ccdb58b5b649af0f80bcccb08b0255eaea/paper-1.20.1-196.jar"
|
| 28 |
|
| 29 |
DATA_DIR = Path("/data")
|
|
|
|
| 4 |
import subprocess
|
| 5 |
import sys
|
| 6 |
import shutil
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
import threading
|
| 9 |
import time
|
|
|
|
| 23 |
print(f"Failed to install pyngrok: {e}")
|
| 24 |
PYNGROK_AVAILABLE = False
|
| 25 |
|
| 26 |
+
try:
|
| 27 |
+
from mcstatus import JavaServer
|
| 28 |
+
except ImportError:
|
| 29 |
+
print("mcstatus not found. Installing...")
|
| 30 |
+
try:
|
| 31 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "mcstatus"])
|
| 32 |
+
from mcstatus import JavaServer
|
| 33 |
+
print("✓ mcstatus installed successfully")
|
| 34 |
+
except Exception as e:
|
| 35 |
+
print(f"Failed to install pyngrok: {e}")
|
| 36 |
+
|
| 37 |
PAPER_JAR_URL = "https://fill-data.papermc.io/v1/objects/234a9b32098100c6fc116664d64e36ccdb58b5b649af0f80bcccb08b0255eaea/paper-1.20.1-196.jar"
|
| 38 |
|
| 39 |
DATA_DIR = Path("/data")
|