Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

mat502 homework

Views: 486
Kernel: Python 2 (Ubuntu Linux)
import numpy as np
npzfiles=np.load("homework502.npz")
--------------------------------------------------------------------------- IOError Traceback (most recent call last) <ipython-input-9-8c032ab3e4c8> in <module>() ----> 1 npzfiles=np.load("homework502.npz") /usr/local/lib/python2.7/dist-packages/numpy/lib/npyio.pyc in load(file, mmap_mode, allow_pickle, fix_imports, encoding) 412 own_fid = False 413 return NpzFile(fid, own_fid=tmp, allow_pickle=allow_pickle, --> 414 pickle_kwargs=pickle_kwargs) 415 elif magic == format.MAGIC_PREFIX: 416 # .npy file /usr/local/lib/python2.7/dist-packages/numpy/lib/npyio.pyc in __init__(self, fid, own_fid, allow_pickle, pickle_kwargs) 171 # Import is postponed to here since zipfile depends on gzip, an 172 # optional component of the so-called standard library. --> 173 _zip = zipfile_factory(fid) 174 self._files = _zip.namelist() 175 self.files = [] /usr/local/lib/python2.7/dist-packages/numpy/lib/npyio.pyc in zipfile_factory(file, *args, **kwargs) 101 import zipfile 102 kwargs['allowZip64'] = True --> 103 return zipfile.ZipFile(file, *args, **kwargs) 104 105 /usr/lib/python2.7/zipfile.pyc in __init__(self, file, mode, compression, allowZip64) 768 try: 769 if key == 'r': --> 770 self._RealGetContents() 771 elif key == 'w': 772 # set the modified flag so central directory gets written /usr/lib/python2.7/zipfile.pyc in _RealGetContents(self) 827 # self.start_dir: Position of start of central directory 828 self.start_dir = offset_cd + concat --> 829 fp.seek(self.start_dir, 0) 830 data = fp.read(size_cd) 831 fp = cStringIO.StringIO(data) IOError: [Errno 22] Invalid argument
npzfiles.files
Exception AttributeError: "'NpzFile' object has no attribute 'zip'" in <bound method NpzFile.__del__ of <numpy.lib.npyio.NpzFile object at 0x7fbf0bba08d0>> ignored
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-10-c75fa6f5ff49> in <module>() ----> 1 npzfiles.files NameError: name 'npzfiles' is not defined