Skip to content

Readme should mention delimiter #3

@ismith

Description

@ismith

I assumed a csv tool would default to ',' as the delimiter, but this defaults to ';'. This is mentioned in the terminal help, but not the readme, and the failure mode is an IndexError, which is confusing:

Traceback (most recent call last):
  File "./csv_anonymizer.py", line 152, in <module>
    anonymize(source, target, column_index, int(ARGS.headerLines), ARGS.encoding, delimiter)
  File "./csv_anonymizer.py", line 96, in anonymize
    for row in anonymize_rows(reader, columnIndex):
  File "./csv_anonymizer.py", line 74, in anonymize_rows
    if len(row[columnIndex].strip()) > 0:
IndexError: list index out of range

(Because csv_anonymizer assumes ';', and your csv uses ',', csv_anonymizer is likely to treat a row as a single large field, and thus fail if given a columnIndex > 0.)

In addition to mentioning --delimiter in the readme, perhaps a try/except around that error, with a user-friendly warning if len(row) == 1?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions