-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentry.py
52 lines (39 loc) · 1.22 KB
/
entry.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
import csv
import subprocess
import sys
import os
import csv
import subprocess
import sys
import os
filename = sys.argv[2]
# initializing the titles and rows list
if sys.argv[1] == "-d":
fields = []
rows = []
if filename[-3:] != "csv":
rows = [["_", filename]]
else:
# reading csv file
with open(filename, 'r') as csvfile:
# creating a csv reader object
csvreader = csv.reader(csvfile)
# extracting field names through first row
_ = next(csvreader)
fields = next(csvreader)
# extracting each data row one by one
for row in csvreader:
rows.append(row)
for i in range(len(rows)):
print("Running for address", rows[i][1])
c = f"python3 run.py -d {rows[i][1]} 3600".split()
subprocess.run(c)
print("---------------------\n")
else :
rows = os.listdir(filename)
for i in range(len(rows)):
if rows[i][-3:] == "sol":
print("Running for file", filename + '/' + rows[i])
c = f"python3 run.py -f {filename}/{rows[i]} 3600".split()
subprocess.run(c)
print("---------------------\n")