This repository has been archived by the owner on Feb 25, 2020. It is now read-only.
forked from RLBot/RLBotPythonExample
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
44 lines (34 loc) · 1.36 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
# https://stackoverflow.com/a/51704613
try:
from pip import main as pipmain
except ImportError:
from pip._internal import main as pipmain
DEFAULT_LOGGER = "rlbot"
if __name__ == "__main__":
try:
from rlbot.utils import public_utils, logging_utils
logger = logging_utils.get_logger(DEFAULT_LOGGER)
if not public_utils.have_internet():
logger.log(
logging_utils.logging_level, "Skipping upgrade check for now since it looks like you have no internet",
)
elif public_utils.is_safe_to_upgrade():
pipmain(["install", "-r", "requirements.txt", "--upgrade", "--upgrade-strategy=eager"])
# https://stackoverflow.com/a/44401013
rlbots = [module for module in sys.modules if module.startswith("rlbot")]
for rlbot_module in rlbots:
sys.modules.pop(rlbot_module)
except ImportError:
pipmain(["install", "-r", "requirements.txt", "--upgrade", "--upgrade-strategy=eager"])
try:
if len(sys.argv) > 1 and sys.argv[1] == "gui":
from rlbot.gui.qt_root import RLBotQTGui
RLBotQTGui.main()
else:
from rlbot import runner
runner.main()
except Exception as e:
print("Encountered exception: ", e)
print("Press enter to close.")
input()