csv delimiter fix

This commit is contained in:
Firq 2024-09-30 22:53:36 +02:00
parent 3046b1ee7b
commit 79ba939fce
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20
2 changed files with 5 additions and 2 deletions

View file

@ -1,6 +1,6 @@
[project] [project]
name = "support_formatter" name = "support_formatter"
version = "0.1.0-a.1" version = "0.1.0-a.2"
requires-python = ">= 3.10" requires-python = ">= 3.10"
authors = [{name = "Firq", email = "firelp42@gmail.com"}] authors = [{name = "Firq", email = "firelp42@gmail.com"}]
maintainers = [{name = "Firq", email = "firelp42@gmail.com"}] maintainers = [{name = "Firq", email = "firelp42@gmail.com"}]

View file

@ -15,7 +15,10 @@ def process_csv(path: pathlib.Path):
data, entries = {}, [] data, entries = {}, []
with open(path, "r") as csv_file: with open(path, "r") as csv_file:
csv_reader = csv.DictReader(csv_file) dialect = csv.Sniffer().sniff(csv_file.read(1024), delimiters=";,")
csv_file.seek(0)
csv_reader = csv.DictReader(csv_file, dialect=dialect)
csv_type = determine_type(csv_reader.fieldnames) csv_type = determine_type(csv_reader.fieldnames)
if csv_type == "unknown": if csv_type == "unknown":