-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun.py
More file actions
36 lines (28 loc) · 1.28 KB
/
run.py
File metadata and controls
36 lines (28 loc) · 1.28 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
# -*- coding: utf-8 -*-
import os
import sys
from pathlib import Path
from subprocess import Popen
##############################################################################################################################
# Get current directory
currentDir = Path(sys.argv[0]).parent.as_posix()
def run(
modelDir: str,
profileDir: str,
):
resourceDir = Path(sys._MEIPASS).as_posix() if getattr(sys, 'frozen', None) else currentDir
serverDir = Path(f'{resourceDir}{os.sep}server').as_posix()
serverFile = Path(f'{serverDir}{os.sep}main.py').as_posix()
serverCMD = f'python "{serverFile}" --modelDir "{modelDir}"'
Popen(serverCMD)
clientDir = Path(f'{resourceDir}{os.sep}client').as_posix()
clientFile = Path(f'{clientDir}{os.sep}main.py').as_posix()
clientCMD = f'python "{clientFile}" --profile "{profileDir}"'
Popen(clientCMD)
##############################################################################################################################
if __name__ == "__main__":
run(
modelDir = Path(currentDir).joinpath('models').as_posix(),
profileDir = Path(currentDir).joinpath('profile').as_posix()
)
##############################################################################################################################