ratal / mdfreader

Read Measurement Data Format (MDF) versions 3.x and 4.x file formats in python
Other
169 stars 74 forks source link

mdfreader is returning error after upgrade to 2.7.5 when reading mdf files #143

Closed Mark584 closed 5 years ago

Mark584 commented 6 years ago

Pyhton version

3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]

Platform information

Windows-10-10.0.15063-SP0

Numpy version

1.14.2

mdfreader version

2.7.5

Description

After upgrading from mdfreader 2.7.4 to 2.7.5, it won't read my mdf files anymore. Executing the following command:

yop = mdfreader.mdf('MDF-File.mdf')

will return:

  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\mdfreader\mdfinfo3.py", line 638, in read_ce_block
    temp['name'] = temp['name'].rstrip(b'\x00').decode('latin1', 'replace')

KeyError: 'name'

Before upgrading mdfreader, it worked with my mdf-files. How can I solve this problem?

ratal commented 6 years ago

Hi Mark, You should replace this line with this below: temp['message'] = temp['message'].rstrip(b'\x00').decode('latin1', 'replace') This is available in dev branch, issue #141 , Ginseil could identify and already give correction.

Mark584 commented 6 years ago

Thanks for your response!

I changed this line, but now I'm getting a different error somehow:

  File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\mdfreader\mdfinfo3.py", line 99, in __init__
    self.filterChannelNames = filterChannelNames

TypeError: descriptor 'filterChannelNames' for 'info3' objects doesn't apply to 'info3' object
ratal commented 6 years ago

I cannot understand, there should be below line slots = ['fileName', 'fid', 'filterChannelNames'] under info3 declaration, so this TypeError does not make sense. Did you change anything ?

Brausepaul commented 6 years ago

I can confirm the original issue but not the following problem mentioned.

ratal commented 6 years ago

Hi Brausepaul, replacing buggy line by temp['message'] = temp['message'].rstrip(b'\x00').decode('latin1', 'replace') can solve your issue ? (it is in dev branch)

Brausepaul commented 6 years ago

Sorry, after re-reading my previous comment I think I was unclear. I did have the same issue with 2.7.5 but replacing the line mentioned fixed it for me.

ratal commented 6 years ago

Thanks Brausepaul. Mark584, do you still have this issue ?

ratal commented 5 years ago

long time no feedback, seems fixed, closing