mirror of
https://github.com/FAUSheppy/ths-reference-data-collector
synced 2025-12-06 06:51:35 +01:00
fix: windows localization based on LC_TIME
This commit is contained in:
12
main.py
12
main.py
@@ -13,7 +13,12 @@ import openpyxl
|
|||||||
import glob
|
import glob
|
||||||
import calendar
|
import calendar
|
||||||
|
|
||||||
|
import locale
|
||||||
import fallback_csv
|
import fallback_csv
|
||||||
|
import platform
|
||||||
|
|
||||||
|
if not platform.system() == "Linux":
|
||||||
|
locale.setlocale(locale.LC_TIME, "de_DE.UTF-8")
|
||||||
|
|
||||||
CSV_DIR = "csvfiles"
|
CSV_DIR = "csvfiles"
|
||||||
CACHE_DIR = "cache"
|
CACHE_DIR = "cache"
|
||||||
@@ -108,8 +113,11 @@ def checkLastMonths(backwardsMonths=6):
|
|||||||
fullContentDict.update({ d.time : [d] })
|
fullContentDict.update({ d.time : [d] })
|
||||||
|
|
||||||
# parse and dump
|
# parse and dump
|
||||||
csvOut = os.path.join(CSV_DIR, 'Wetterdaten-{}-{}.csv'.format(
|
mname = calendar.month_name[monthNumber]
|
||||||
calendar.month_name[monthNumber], year))
|
if monthNumber == 3:
|
||||||
|
mname = "März" # fix german months
|
||||||
|
|
||||||
|
csvOut = os.path.join(CSV_DIR, 'Wetterdaten-{}-{}.csv'.format(mname, year))
|
||||||
with open(csvOut, 'w', newline='', encoding="utf-8") as file:
|
with open(csvOut, 'w', newline='', encoding="utf-8") as file:
|
||||||
|
|
||||||
fieldnames = list(headerMappings.values())
|
fieldnames = list(headerMappings.values())
|
||||||
|
|||||||
Reference in New Issue
Block a user