From: Michael Tremer Date: Thu, 7 Mar 2024 14:03:16 +0000 (+0000) Subject: importer: Convert the file handle to text before passing to the CSV parser X-Git-Tag: 0.9.18~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa5dccf15a568cd389cfb86c0ce0fca3cd3096dc;p=location%2Flibloc.git importer: Convert the file handle to text before passing to the CSV parser Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index c9fd9a8..88f422f 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -22,6 +22,7 @@ import asyncio import csv import functools import http.client +import io import ipaddress import json import logging @@ -964,6 +965,9 @@ class CLI(object): self._parse_line(line, source, countries) async def _import_arin_as_names(self, source, countries, f, *args): + # Wrap the data to text + f = io.TextIOWrapper(f) + # Walk through the file for line in csv.DictReader(f, dialect="arin"): log.debug("Processing object: %s" % line)