Created
September 1, 2017 02:40
-
-
Save osvalr/d850df821e60dca608f0bb3da1188dff to your computer and use it in GitHub Desktop.
test if a zipfile is ok
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import argv | |
import zipfile | |
from zipfile import BadZipFile | |
message = "zip file okay" | |
try: | |
the_zip_file = zipfile.ZipFile(argv[1]) | |
except BadZipFile: | |
message = "Bad file detected" | |
finally: | |
print(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test it with something like the following: