Skip to content

Improve error message in case of misidentification of dialect (ValueError: Can't decode base64) #218

Description

@israelst

When I run the code bellow, I got the error ValueError: Can't decode base64 because rows use the first line to discover the csv dialect, but the text present at the following line breaks the expectation.

import rows
from io import BytesIO


csv = BytesIO(b"""problematic_text,cool_number
,42
"Problematic text with commas, ""quotes"" and a cool number: 4,2", 84""")

table = rows.import_from_csv(csv)
print(list(table))

The problem is solved if you add the dialect explicitly:

table = rows.import_from_csv(csv, dialect='excel')

but would be very nice to have a error message that points us to the right direction, like talking about dialects or just by telling the row and field where error happened.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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