Skip to content

Upload csv file always with error "file provided is not a csv file" #25

@canglongxiang

Description

@canglongxiang

Problem:
Upload a csv file (download from: https://kanaries-app.s3.ap-northeast-1.amazonaws.com/public-datasets/bike_sharing_dc.csv) with default view as: http://127.0.0.1:8000/pygwalker/, it always throw error "file provided is not a csv file".

After check source code, found in below:

if mimetypes.guess_type(csv_file.name)[0] not in ["text/csv"]:

And the root cause is the mimetypes.guess_type return value "application/vnd.ms-excel" from Python mimetypes.py, which the value is cause by
db.read_windows_registry()

Image

Solution:
Maybe add the value "application/vnd.ms-excel" to code like this:
if mimetypes.guess_type(csv_file.name)[0] not in ["text/csv", "application/vnd.ms-excel"]:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions