Commit fe12a5b8 authored by Philippe Bardou's avatar Philippe Bardou

Minor change (rename variable, input file test)

parent 207bc5b9
......@@ -70,15 +70,15 @@ class AppServer(object):
FH = open(file,'r')
names = {}
samples = {}
linenb = 0
fieldnb = 0
for i, line in enumerate(FH.readlines()):
if i == 0:
linenb = len(line.split(spliter))
fieldnb = len(line.split(spliter))
if i == 0 and header:
for j, val in enumerate(line.split(spliter)):
names[string.ascii_uppercase[j]] = val.rstrip('\n\r')
linenb = len(names)
fieldnb = len(names)
else:
for j, val in enumerate(line.split(spliter)):
if i == 0:
......@@ -86,10 +86,10 @@ class AppServer(object):
if j in samples:
samples[j].append(val)
else:
samples[j] = [val]
if linenb != len(line.split(spliter)):
samples[j] = [val]
if fieldnb < len(line.split(spliter)):
return json.dumps([{'error':"Error: Inconsistent number of fields line " + str(i+1) +
" (" + str(len(line.split(spliter))) + " for " + str(linenb) + " expected)"}])
" (" + str(len(line.split(spliter))) + " for " + str(fieldnb) + " expected)"}])
d = {}
j = 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment