Skip to content

fix(loaders): say "unsupported format" for .xls, .ods and other binary files (#1018) - #1034

Merged
yakew7 merged 1 commit into
yakew7:mainfrom
minutechreview:fix/unsupported-format-error-1018
Oct 17, 2026
Merged

yakew7 merged 1 commit into
yakew7:mainfrom
minutechreview:fix/unsupported-format-error-1018

Conversation

@minutechreview

Copy link
Copy Markdown
Contributor

Summary

faircode audit on an .xls or .ods file used to fail with a confusing message about --encoding and invalid UTF-8, because the file was read as text. It now says which format is not supported and what to do:

error: could not read dataset data.xls: unsupported format .xls: save it as .xlsx or .csv

The exit code is still 2.

In faircode/loaders.py, read_table now raises a ValueError for .xls, .ods, .feather, .pkl, .zip and .7z, before falling back to the delimited-text reader. The check only applies when the file exists, so a missing file still reports "file not found". The suffix check ignores case (.XLS too). Unknown text extensions such as .dat are still sniffed as before.

Tests are in tests/test_loaders.py (each unsupported suffix, uppercase, missing file, unknown text extension) and tests/test_cli.py (exit code 2, the message names the format, no --encoding hint).

The web UI already rejects anything that is not csv, tsv, json or xlsx, so I left the JS alone.

Type

  • Audit
  • Explainer
  • Bug fix
  • Other

Linked issue

Closes #1018

Checks: pytest tests --ignore=tests/browser gives 707 passed, 41 skipped (scipy installed). ruff check and scripts/check_em_dash.py pass.

…he encoding (yakew7#1018)

Signed-off-by: minutechreview <141821420+minutechreview@users.noreply.github.com>
@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@minutechreview is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

@yakew7 @ahmdkaml - new PR touching a path you own, please review.

@yakew7
yakew7 merged commit aa98442 into yakew7:main Oct 17, 2026
18 of 19 checks passed
yakew7 added a commit that referenced this pull request Oct 17, 2026
…th sweep

Adds the fourteenth-wave changelog entries, marks the closed follow-ups done and lists the 17 new ones (#1036-#1052), adds @prami25r and @minutechreview's #1034 to the contributors file, and refreshes traction (forks 58, contributors 53, 123 issues closed this week).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A legacy .xls file gets a misleading 'not valid utf-8, pass --encoding' error

2 participants