-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.py
More file actions
27 lines (23 loc) · 806 Bytes
/
Copy pathhelper.py
File metadata and controls
27 lines (23 loc) · 806 Bytes
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
from dotenv import dotenv_values
import csv
# LOAD ENVIRONMENT VARIABLES FROM .env
configs = dotenv_values(".env_var")
# LOAD EMAILS FROM .emails.txt
try:
emails = {}
with open(configs["FILE_EMAILS"], "r") as email_file:
for line in csv.reader(email_file, delimiter=","):
if line[0] == 'name':
continue
name, email = line
emails[name.strip().lower()] = email.strip().lower()
except:
emails = {}
print(f"*** ERROR: Could not open file {configs['FILE_EMAILS']}")
### LOAD UTILITIES FROM utilities.txt
try:
with open(configs["FILE_UTILITIES"], "r") as utility_file:
utilities = utility_file.read().replace("\n", ", ")
except:
utilities = {}
print(f"*** ERROR: Could not open file {configs['FILE_UTILITIES']}")