3

I generated a dataset about 7 hours and saved it as

np.savez("/content/gdrive/My Drive/allc.npz", all=all, lab=lab)

Then, I opened and check the file

d=np.load("/content/gdrive/My Drive/allc.npz")
all=d["all"]
l=d["lab"]
all.shape

And, it worked perfectly

But, today, i opened the file using np.load it shows

BadZipFile: File is not a zip file

What is happened and what to do. Any suggestion

Thank you

3
  • 1
    This is not a programming question. Your problem seems to be that your original working .npz file has been overwritten, replaced, or corrupted. Most likely you overwrote it by mistake. Commented Nov 30, 2019 at 7:13
  • Ok, do you know how to resolve it... Thanks Commented Nov 30, 2019 at 7:41
  • 1
    You should restore the correct file from your backup system, or re-run the program which generated it in the first place if you don't have backups. Commented Nov 30, 2019 at 11:35

1 Answer 1

2

Another possibility is that the .npz file is not fully available to start working, as mentioned in the first comment.

In my case, I wanted to load a local .npz file on a google Colab, while uploading I tried to load it and received the BadZipFile: File is not a zip file error. Later, I realized the uploading circle was still incomplete.

So make sure .npz is fully available.

Sign up to request clarification or add additional context in comments.

1 Comment

The same problem when working locally. A little patience after creating the file to load it again was enough :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.