forked from Tyler-Hecht/Coder-File-Reconciling
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup1.py
More file actions
44 lines (38 loc) · 1.13 KB
/
setup1.py
File metadata and controls
44 lines (38 loc) · 1.13 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 os
import glob
import shutil
import subprocess
from openpyxl import *
del open
from pandas import *
path = os.getcwd()
if os.name == "nt":
sep = "\\"
else:
sep = "/"
input_path = path + "/INPUT/"
output_path = path + "/OUTPUT/"
combined_file = glob.glob(os.path.join(input_path, "*.xlsx"))
third_code = glob.glob(os.path.join(input_path, "*.csv"))
# get input files
if len(combined_file) == 0:
print("ERROR: no combined file found")
exit(1)
if len(third_code) == 0:
print("ERROR: no third coder file found")
exit(1)
if len(combined_file) > 2:
print("ERROR: multiple combined files found")
exit(1)
if len(third_code) > 2:
print("ERROR: multiple third coder files found")
exit(1)
combined_file = combined_file[0]
combined_file_name = combined_file.split(sep)[-1]
third_code = third_code[0]
third_code_name = third_code.split(sep)[-1]
os.chdir(input_path)
dts_input_path = path + "/DatavyuToSupercoder/Input/"
dts_output_path = path + "/DatavyuToSupercoder/Output/"
# move file to DTS input
shutil.copyfile(third_code_name, dts_input_path + third_code_name)