forked from RLBot/RLBotJavaExample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
38 lines (31 loc) · 1.02 KB
/
run.py
File metadata and controls
38 lines (31 loc) · 1.02 KB
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
# https://stackoverflow.com/a/51704613
try:
from pip import main as pipmain
except ImportError:
from pip._internal import main as pipmain
# https://stackoverflow.com/a/24773951
def install_and_import(package):
import importlib
try:
importlib.import_module(package)
except ImportError:
pipmain(['install', package])
finally:
globals()[package] = importlib.import_module(package)
if __name__ == '__main__':
install_and_import('rlbot')
from rlbot.utils import public_utils
if public_utils.is_safe_to_upgrade():
pipmain(['install', '-r', 'requirements.txt', '--upgrade', '--upgrade-strategy=eager'])
try:
import sys
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()