-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlauncher.py
More file actions
33 lines (26 loc) · 890 Bytes
/
launcher.py
File metadata and controls
33 lines (26 loc) · 890 Bytes
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
import os
import sys
import subprocess
import venv
def create_venv():
if not os.path.exists("venv"):
print("Creating virtual environment...")
venv.create("venv", with_pip=True)
def install_requirements():
pip_executable = os.path.join("venv", "bin", "pip")
if sys.platform == "win32":
pip_executable = os.path.join("venv", "Scripts", "pip")
print("Installing requirements...")
subprocess.check_call([pip_executable, "install", "-r", "requirements.txt"])
def run_bot():
python_executable = os.path.join("venv", "bin", "python")
if sys.platform == "win32":
python_executable = os.path.join("venv", "Scripts", "python")
print("Starting bot...")
subprocess.call([python_executable, "main.py"])
def main():
create_venv()
install_requirements()
run_bot()
if __name__ == "__main__":
main()