echemdata / galvani

Read proprietary file formats from electrochemical test stations
GNU General Public License v3.0
47 stars 30 forks source link

OSError: Unexpected end of file while reading data might due incompatibility with EC-lab 11.50 #93

Closed Roy027 closed 12 months ago

Roy027 commented 12 months ago

OSError Traceback (most recent call last) Cell In[4], line 28

26 for file in files:
     27     file_name = file.split('.')[0]
---> 28     mpr_file = BioLogic.MPRfile(file)
     29     df = pd.DataFrame(mpr_file.data)
     30     columns_list = df.columns.tolist()
    [379](//galvani/BioLogic.py?line=378) if magic != MPR_MAGIC:
    [380](//galvani/BioLogic.py?line=379)     raise ValueError('Invalid magic for .mpr file: %s' % magic)
--> [382](//galvani/BioLogic.py?line=381) modules = list(read_VMP_modules(mpr_file))
    [383](/galvani/BioLogic.py?line=382) self.modules = modules
    [384](/galvani/BioLogic.py?line=383) settings_mod, = (m for m in modules if m['shortname'] == b'VMP Set   ')
/galvani\BioLogic.py:341, in read_VMP_modules(fileobj, read_module_data)
    [339](//galvani/BioLogic.py?line=338)     hdr_dict['data'] = fileobj.read(hdr_dict['length'])
    [340](//galvani/BioLogic.py?line=339)     if len(hdr_dict['data']) != hdr_dict['length']:
--> [341](//galvani/BioLogic.py?line=340)         raise IOError("""Unexpected end of file while reading data
    [342](//galvani/BioLogic.py?line=341)             current module: %s
    [343](//galvani/BioLogic.py?line=342)             length read: %d
    [344](//galvani/BioLogic.py?line=343)             length expected: %d""" % (hdr_dict['longname'],
    [345](//galvani/BioLogic.py?line=344)                                       len(hdr_dict['data']),
    [346](//galvani/BioLogic.py?line=345)                                       hdr_dict['length']))

...

OSError: Unexpected end of file while reading data current module: b'VMP settings ' length read: 25211 length expected: 4294967295

ml-evs commented 12 months ago

This is known and I think a few people are working towards fixing it; see #87 for a longer discussion