Fiksa at første linje i mtr fila ble hoppa over

This commit is contained in:
Trygve 2022-03-27 19:18:51 +02:00
parent c15fd70cf2
commit 09723e6966

View File

@ -214,11 +214,8 @@ class card_punch:
def list_from_mtr_f(mtr_f): def list_from_mtr_f(mtr_f):
csvreader = csv.reader(open(mtr_f)) csvreader = csv.reader(open(mtr_f))
fields = next(csvreader)
fields = []
rows = [] rows = []
cards = [] cards = []
# hver rad er brikkenummer med tilhørende info # hver rad er brikkenummer med tilhørende info
for row in csvreader: for row in csvreader:
@ -287,7 +284,7 @@ def courses_from_ttime_conf(ttime_file = 'sc_2021_ttime/ttime.cnf.txt'):
return courses return courses
def classes_from_ttime_conf(ttime_file, courses): def classes_from_ttime_conf(ttime_file, courses):
o_classes = [] o_classes = []
conf = open(ttime_file, 'r').readlines() conf = open(ttime_file, 'r', encoding='latin_1').readlines()
for line in conf: for line in conf:
if '-courses' in line: if '-courses' in line:
raw_courselist = re.search(r'(?<=\")(.*?)(?=\")', line).group().split(';') raw_courselist = re.search(r'(?<=\")(.*?)(?=\")', line).group().split(';')