X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c3788d765ed4e7ddf00794085af757714bc102cf..2d1a22705f7f2f067f2c839c32caf55941a37b01:/nominatim/tools/postcodes.py diff --git a/nominatim/tools/postcodes.py b/nominatim/tools/postcodes.py index adc58ec5..2b7027e7 100644 --- a/nominatim/tools/postcodes.py +++ b/nominatim/tools/postcodes.py @@ -36,7 +36,7 @@ class _CountryPostcodesCollector: def __init__(self, country): self.country = country - self.collected = dict() + self.collected = {} def add(self, postcode, x, y): @@ -136,13 +136,13 @@ class _CountryPostcodesCollector: def _open_external(self, project_dir): - fname = project_dir / '{}_postcodes.csv'.format(self.country) + fname = project_dir / f'{self.country}_postcodes.csv' if fname.is_file(): LOG.info("Using external postcode file '%s'.", fname) - return open(fname, 'r') + return open(fname, 'r', encoding='utf-8') - fname = project_dir / '{}_postcodes.csv.gz'.format(self.country) + fname = project_dir / f'{self.country}_postcodes.csv.gz' if fname.is_file(): LOG.info("Using external postcode file '%s'.", fname)