From c852de734dbc8d95ac925c103f4cad563d3f9e53 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 22 Aug 2018 12:42:23 +0100 Subject: [PATCH] Fix cron/build_chrom_db.py Fix the following errors: ``` $ python cron/build_chrom_db.py tool-data/shared/ucsc/chrom/ tool-data/shared/ucsc/builds.txt Retrieving hg38 Failed to retrieve hg38: Problem parsing line '' Retrieving hg19 Failed to retrieve hg19: Problem parsing line '' ... ``` Broken in commit 9b8e76f9d9df0ae0ba6238d44a8f07b97fe34d6f . --- cron/build_chrom_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cron/build_chrom_db.py b/cron/build_chrom_db.py index 11454eb2ff3..b3c7094238b 100644 --- a/cron/build_chrom_db.py +++ b/cron/build_chrom_db.py @@ -37,7 +37,7 @@ def getchrominfo(url, db): "position": "", "hgta_doTopSubmit": "get info"}) page = requests.get(URL).text - for line in page.split('\n'): + for i, line in enumerate(page.splitlines()): line = line.rstrip("\r\n") if line.startswith("#"): continue @@ -45,7 +45,7 @@ def getchrominfo(url, db): if len(fields) > 1 and len(fields[0]) > 0 and int(fields[1]) > 0: yield [fields[0], fields[1]] else: - raise Exception("Problem parsing line '%s'" % line) + raise Exception("Problem parsing line %d '%s' in page '%s'" % (i, line, page)) if __name__ == "__main__":