-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_maps.py
37 lines (29 loc) · 882 Bytes
/
create_maps.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
#!/usr/bin/python
import sys
import os
import subprocess
import os, shutil, fnmatch
import subprocess
import time
from multiprocessing import Pool
def createMap(country):
country_name=country[0]
id=country[1]
style=country[2]
url=country[3]
if(not country_name.startswith('#')):
print("Update "+country_name+ " "+id+" "+style+" "+url)
#Launch script
subprocess.run(["bash", "create_map.sh",country_name,id,style])
if __name__ == '__main__':
country_list=[]
#File country
file_in = open("country.txt", "rt")
lines = file_in.readlines()
for line in lines:
result = line.split(";")
country_list.append([result[0],result[1],result[2],result[3]])
file_in.close()
with Pool(processes=3) as pool:
# call the function for each item in parallel
pool.map(createMap, country_list)