HELP BadZipFile: File is not a zip file

2,005 views
Skip to first unread message

emper...@gmail.com

unread,
Apr 18, 2017, 8:48:08 AM4/18/17
to Keras-users
when i try to run  (x_train, y_train), (x_test, y_test) = mnist.load_data() 
Error is follow :
(x_train, y_train), (x_test, y_test) = mnist.load_data()
Traceback (most recent call last):

  File "<ipython-input-53-7bc35c760fc5>", line 1, in <module>
    (x_train, y_train), (x_test, y_test) = mnist.load_data()

  File "C:\Users\Aramis\Anaconda3\lib\site-packages\keras\datasets\mnist.py", line 16, in load_data
    f = np.load(path)

  File "C:\Users\Aramis\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 399, in load
    pickle_kwargs=pickle_kwargs)

  File "C:\Users\Aramis\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 162, in __init__
    _zip = zipfile_factory(fid)

  File "C:\Users\Aramis\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 92, in zipfile_factory
    return zipfile.ZipFile(*args, **kwargs)

  File "C:\Users\Aramis\Anaconda3\lib\zipfile.py", line 1026, in __init__
    self._RealGetContents()

  File "C:\Users\Aramis\Anaconda3\lib\zipfile.py", line 1093, in _RealGetContents
    raise BadZipFile("File is not a zip file")

BadZipFile: File is not a zip file



Message has been deleted

hysol...@gmail.com

unread,
Apr 30, 2017, 8:41:54 AM4/30/17
to Keras-users

Hi,Aramis.Have you already known how to fix this problem?I recently started learning Keras,following official CNN examples and met the same problem.It seems that MNIST.npz formation is not correct.When I'm running the example:https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py
Here's the result
Using TensorFlow backend.
Traceback (most recent call last):
  File "C:/Users/hy/Desktop/程序/MNIST/mnist_cnn.py", line 17, in <module>
    (x_train, y_train), (x_test, y_test) = mnist.load_data()
  File "C:\Anaconda3\lib\site-packages\keras\datasets\mnist.py", line 16, in load_data
    f = np.load(path)
  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 412, in load
    pickle_kwargs=pickle_kwargs)
  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 171, in __init__
    _zip = zipfile_factory(fid)
  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 101, in zipfile_factory
    return zipfile.ZipFile(file, *args, **kwargs)
  File "C:\Anaconda3\lib\zipfile.py", line 1026, in __init__
    self._RealGetContents()
  File "C:\Anaconda3\lib\zipfile.py", line 1093, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
Exception ignored in: <bound method NpzFile.__del__ of <numpy.lib.npyio.NpzFile object at 0x000001D3B38DB978>>
Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 208, in __del__
    self.close()
  File "C:\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 199, in close
    if self.zip is not None:
AttributeError: 'NpzFile' object has no attribute 'zip'

holeu...@gmail.com

unread,
Jun 6, 2017, 4:44:34 AM6/6/17
to Keras-users, hysol...@gmail.com

Hi,Did you fix it?,I Have encountered this problem。ths!
在 2017年4月30日星期日 UTC+8下午8:41:54,hysol...@gmail.com写道:

holeu...@gmail.com

unread,
Jun 6, 2017, 5:00:18 AM6/6/17
to Keras-users
just remove your database downloaded at ur root folder. and run again. make sure ur connection, because this problem caused by the database you downloaded is failed

在 2017年4月18日星期二 UTC+8下午8:48:08,emper...@gmail.com写道:
Reply all
Reply to author
Forward
0 new messages