From: Christian Heller Date: Wed, 1 Jul 2020 19:18:23 +0000 (+0200) Subject: De-hardcode infections table path from enhance_table.py. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/template?a=commitdiff_plain;h=d90d54eb25c326364575d062543664a214506210;p=berlin-corona-table De-hardcode infections table path from enhance_table.py. --- diff --git a/enhance_table.py b/enhance_table.py index 11f65eb..2b6bb8d 100755 --- a/enhance_table.py +++ b/enhance_table.py @@ -1,5 +1,11 @@ #!//usr/bin/env python3 +import sys +if len(sys.argv) != 2: + print('Expecting infections table file path as only argument.') + exit(1) +infections_table = sys.argv[1] + # District population numbers as per Wikipedia. district_pops = { 'CW': 342332, @@ -17,7 +23,7 @@ district_pops = { 'sum': 3754418, } -f = open('daily_infections_table.txt', 'r') +f = open(infections_table, 'r') lines = f.readlines() f.close() diff --git a/update.sh b/update.sh index f1b7467..1bfd38b 100755 --- a/update.sh +++ b/update.sh @@ -18,4 +18,4 @@ curl "${CSV_URL}" \ 'END { printf "\n" }' "${filename}" >> "${table_path}" # Write enhanced table output to directory served by web server. -./enhance_table.py > /var/www/html/berlin_corona.txt +./enhance_table.py "${table_path}" > /var/www/html/berlin_corona.txt