From 818bd9d80ff464e605a3792e0c39216e24643bad Mon Sep 17 00:00:00 2001 From: bkmartinjr Date: Thu, 21 Jan 2021 15:37:43 -0800 Subject: [PATCH] fix sniffing bug --- server/common/annotations/local_file_csv.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/common/annotations/local_file_csv.py b/server/common/annotations/local_file_csv.py index 4604f4cd..c753cf2a 100644 --- a/server/common/annotations/local_file_csv.py +++ b/server/common/annotations/local_file_csv.py @@ -108,14 +108,12 @@ class AnnotationsLocalFile(Annotations): with self.genesets_lock: if fname is not None and os.path.exists(fname) and os.path.getsize(fname) > 0: with open(fname, newline="") as f: - sample = f.read(1024) - f.seek(0) - sniffer = csv.Sniffer() - dialect = sniffer.sniff(sample) - dialect.skipinitialspace = True - reader = csv.reader(f, dialect) - haveReadHeader = False + class myDialect(csv.excel): + skipinitialspace = True + reader = csv.reader(f, dialect=myDialect()) + + haveReadHeader = False for row in reader: if len(row) == 0: continue