-
Notifications
You must be signed in to change notification settings - Fork 26
/
run.py
82 lines (72 loc) · 2.02 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from settings._first_load_ import check_if_first_time
from main import main
import sys , os
from settings.settings import read_bot
from system.path import getpath
def get_args(lt,lim):
get = ''
for i in range(1,lim):
get += str(lt[i]) + ' '
return get.strip()
def all_args(lt):
ok = False
arg = ''
for w in lt:
if ok:
arg += w +' '
if w=='-arg':
ok = True
return arg.strip()
def make_path(lt,lim):
path = ''
ok = False
for i in range(1,lim):
if lt[i] == '-arg':
break
if ok:
path += ' '
path += lt[i]
ok = True
return path
if __name__ == "__main__":
try :
total = len(sys.argv)
lt = list(sys.argv)
if '-arg' in lt:
# orginal_path = lt[0]
# orginal_path = orginal_path[0:len(orginal_path)-6]
# print(orginal_path)
orginal_path = getpath(__file__)
p = str(sys.argv)
file_path = make_path(lt,total)
os.chdir(file_path)
# print(orginal_path)
arg = all_args(lt)
main(arg,orginal_path)
else :
arg = get_args(lt,len(lt))
main(arg.strip() , orginal_path=os.getcwd())
except Exception as e:
# print(e)
main(orginal_path=os.getcwd())
def start():
try :
total = len(sys.argv)
lt = list(sys.argv)
if '-arg' in lt:
# orginal_path = lt[0]
# orginal_path = orginal_path[0:len(orginal_path)-6]
# print(orginal_path)
orginal_path = getpath(__file__)
p = str(sys.argv)
file_path = make_path(lt,total)
os.chdir(file_path)
# print(orginal_path)
arg = all_args(lt)
main(arg,orginal_path)
else :
arg = get_args(lt,len(lt))
main(arg.strip() , orginal_path=os.getcwd())
except Exception as e:
# print(e)
main(orginal_path=os.getcwd())