-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
47 lines (37 loc) · 1.45 KB
/
setup.py
File metadata and controls
47 lines (37 loc) · 1.45 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
45
46
47
import os
import webbrowser
def main():
try:
import time
from dotenv import load_dotenv
import json
from selenium import webdriver
import requests
except ImportError:
print("Installing dependencies...")
os.system("pip install -r requirements.txt")
username = input("What is your Codefun username?\n")
pwd = input("What is the password?\n")
filepath = input(
"What is the absolute path to the folder containing your code?\n").replace("/", "\\")
if (filepath.endswith("\\")):
filepath = filepath[:-1]
lang = input(
"What is the default submitting language? (C++/Python3/Pascal/NAsm)\n")
chromedriverpath = input(
"What is the path to your chromedriver.exe file? (Type NA if you don't have chromedriver.exe)\n")
while chromedriverpath == "NA":
print("Redirecting to https://chromedriver.chromium.org/downloads")
webbrowser.open_new_tab("https://chromedriver.chromium.org/downloads")
chromedriverpath = input(
"What is the path to your chromedriver.exe file?\n")
with open(".env", "w") as f:
f.write(f"CF_USERNAME = {username}\n")
f.write(f"CF_PASSWORD = {pwd}\n")
f.write(f"PATH_TO_FOLDER = {filepath}\n")
f.write(f"LANGUAGE = {lang}\n")
f.write(f"CHROME_PATH = {chromedriverpath}\n")
print("Success")
# TODO: Check for errors
if __name__ == "__main__":
main()