-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
46 lines (39 loc) · 1.19 KB
/
Copy pathsetup.py
File metadata and controls
46 lines (39 loc) · 1.19 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
37
38
39
40
41
42
43
44
import sys
import os
import json
PATHSELENIUM=r"C:\\Program Files (x86)\\chromedriver.exe"
CHROMEDRIVERNAME=r"chromedriver.exe"
REQUIREMENTNAME=r"r.txt"
SETUPJSON=r"setup.json"
##check for setup
setup=json.load(open(SETUPJSON))["setup"]
g={
"setup":"yes",
"all":"ypu"
}
def converttojson(lst):
with open(SETUPJSON, 'w') as json_file:
json.dump(lst, json_file,indent=4,separators=(',',':'))
if setup=="yes":
print("")
else:
#install module first
os.system(f"pip install -r {REQUIREMENTNAME}")
if os.path.exists(PATHSELENIUM):
print(f"{PATHSELENIUM}=====> exist")
converttojson(g)
print("setup complete")
else:
print(f"{PATHSELENIUM}=====> not exist\n adding it automathically")
try:
os.replace("chromedriver.exe",PATHSELENIUM)
except Exception as e:
print(e)
pass
if os.path.exists(PATHSELENIUM):
print("file move successfully ")
converttojson(g)
print("setup complete")
else:
print("pls do it manually ")
print(f"copy file {CHROMEDRIVERNAME} to path {PATHSELENIUM}")