-
Notifications
You must be signed in to change notification settings - Fork 3
/
runTODO.py
36 lines (27 loc) · 873 Bytes
/
runTODO.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
import subprocess
import sys
import os
if(len(sys.argv) != 2):
print('Enter your name as argument.')
exit()
MYNAME = sys.argv[1].capitalize()
DONEPath = '../drive/My Drive/DesignProject/GridSearchDONEs/DONE%s.txt'%MYNAME
cmds = []
with open('GridSearchTODOs/TODO_%s.txt'%MYNAME,'r') as f:
for cmd in f:
cmds.append(cmd)
if(not os.path.exists('../drive/My Drive/DesignProject/')):
os.makedirs('../drive/My Drive/DesignProject/')
if(os.path.exists(DONEPath)):
with open(DONEPath) as f:
done = int(f.read())
else:
done = 0
for cmd in cmds[done:]:
print(cmd)
subprocess.call(cmd,shell=True)
if(not os.path.exists('../drive/My Drive/DesignProject/GridSearchDONEs')):
os.mkdir('../drive/My Drive/DesignProject/GridSearchDONEs')
done+=1
with open(DONEPath,'w') as f:
f.write(str(done))