-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.py
37 lines (29 loc) · 872 Bytes
/
configure.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
import configparser
filename = "file.ini"
# Writing Data
config = configparser.ConfigParser()
config.read(filename)
try:
config.add_section("SETTINGS")
except configparser.DuplicateSectionError:
pass
username = ""
password = ""
email = ""
try:
username = config.get("SETTINGS", "username")
except Exception as e:
if not username:
config.set("SETTINGS", "username", input("Enter a Username : "))
try:
password = config.get("SETTINGS", "password")
except Exception as e:
if not password:
config.set("SETTINGS", "password", input("Enter a Password : "))
try:
email = config.get("SETTINGS", "email")
except Exception as e:
if not email:
config.set("SETTINGS", "email", input("Enter a Email Address : "))
with open(filename, "w") as config_file:
config.write(config_file)