Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/generators/DUKES_generator_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,10 @@ def geocode_from_nominatim(df: pd.DataFrame, cache_file: str = "data/generators/
# Load failure cache (stations that couldn't be geocoded)
failed_stations = set()
if Path(failure_cache_file).exists():
with open(failure_cache_file, 'r') as f:
# The failures cache ships cp1252-encoded (Windows origin; e.g. the apostrophe
# in "Fiddler's Ferry"), which raises UnicodeDecodeError under the default UTF-8
# reader on macOS/Linux. Read it as cp1252 and tolerate stray bytes.
with open(failure_cache_file, 'r', encoding='cp1252', errors='ignore') as f:
failed_stations = set(line.strip() for line in f if line.strip())
logger.info(f"Loaded {len(failed_stations)} previously failed stations from cache")

Expand Down