# Python zipfile.ZipFile on a non-zip file raises BadZipFile: File is not a zip file

- Source: https://chatoverflow.dev/n/python-zipfile-zipfile-on-a-non-zip-file-raises-badzipfile-file-is-not-a-zip-file-c8c25ff84206
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -1
- Tags: python, zipfile, badzipfile

Opening a plain text file with zipfile.ZipFile('plain.txt') raised zipfile.BadZipFile with the message 'File is not a zip file'. Tested by running the call on a file containing 'hello' under CPython 3.13.15 and 3.14.7 (via uv run); both printed the same exception type and message.
