Skip to main content

ErrorFile

ErrorFile是一个用于检测和识别各种文件错误的Python包,包括图片、PDF、Excel和Word文件。通过使用统一的顶层接口,可以快速定位文件中潜在的问题。

安装

你可以通过pip安装ErrorFile:

pip install ErrorFile

快速开始

使用ErrorFile非常简单。推荐直接使用顶层函数inspect_file:

from ErrorFile import inspect_file

file_path = r'tests/files/TOM_损坏.jpg'
# mode 参数由 inspect_file 统一处理,当前仅支持 'precise'
is_ok, message = inspect_file(file_path, mode='precise')
print(f"File: {file_path}\nOK: {is_ok}\nMessage: {message}")

支持的文件类型

目前,ErrorFile支持以下文件类型的检查:

  • 图片(JPEG, JPG, PNG, GIF, BMP, WEBP, TIFF, SVG)
  • PDF
  • Office 文档(Excel:XLSX、XLS;Word:DOCX;PowerPoint:PPTX)
  • 压缩包(ZIP、RAR)
  • 媒体文件(MP3、MP4)

检测模式

图片文件采用精确检测模式(precise),底层基于 Pillow 的 verify() 与 load() 方法,能够快速且可靠地发现问题。非图片文件会自动执行相应的深度检查,无需手动配置模式。

API参考

inspect_file(file_path, mode='precise')

顶层函数,用于检查指定路径的文件是否损坏。

参数

  • file_path:要检查的文件路径。
  • mode:(可选)图片检测模式,目前仅支持 precise,其它文件类型忽略此参数。

返回

  • (is_ok, message):is_ok是布尔值,表示文件是否通过检查;message是详细描述信息。

贡献

欢迎贡献!如果你有任何建议或改进,请提交Pull Request或创建Issue。

许可证

ErrorFile根据Apache-2.0许可证发布。有关详细信息,请查看LICENSE文件。

Metadata

Release files for ErrorFile 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ErrorFile 0.2.1
File Size Uploaded Provenance
errorfile-0.2.1.tar.gz 53.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ErrorFile 0.2.1
File Interpreter ABI Platform
errorfile-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 112.0 kB

Release files / errorfile-0.2.1.tar.gz

Download URL errorfile-0.2.1.tar.gz
Size 53.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3b33a906ae2516cec9ee3a7cb92a291491f2db257b36ab30024bd582fa769665
BLAKE2b-256 checksum
How to use checksums
7fde9a17c2eeeb806c581d938e1cd45db35211ae896332a7b9c93d2d21e8afe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.

Transparency log

Release files / errorfile-0.2.1-py3-none-any.whl

Download URL errorfile-0.2.1-py3-none-any.whl
Size 58.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4919827998a02762aaa219b002d1f0e611252943f83970877ded2b21fd09a8d
BLAKE2b-256 checksum
How to use checksums
32a125f56661f1482fb39d51ac11592a8384adce5bfd01086f9c17cc80066846
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.

Transparency log

Security for ErrorFile 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for errorfile-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page