ratal / mdfreader

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

Error while reading mdf files with field names containing colons #32

Closed donvicario closed 8 years ago

donvicario commented 8 years ago

Hello,

I want to read some MDF files with the mdfreader tool. My MDF files have some fields which are called "Dauermesung_1: Time", "Dauermessung_2: Time", etc. If I read these files with mdfreader.mdf() I get the error

ValueError: ':' is not an allowed character in buffer field names

Is there a chance to fix this?

Best regards, donvicario

ratal commented 8 years ago

Hi, which version of mdf file are you trying to read ? in mdfreader.py, there is a function called _convertMatlabName. It should remove problematic characters and could be reused in the code to solve your issue, for instance in mdf.py add_channel() method.

ratal commented 8 years ago

Do you still have this issue ? Critical ? As no answer for a while, I close this issue, feel free to reopen it.

tivoodoo commented 7 years ago

Hi, I have the same issue reading a MDF 3.00 file right during the initialize phase 2017-05-03 13_24_36-mdfreader_python_test

How exactly should I use the function _convertMatlabName? As I understand, I should modify your code and call _convertMatlabName from add_channel() method. Is it correct? Unfortunately I'm new to Python and don't know how to modify the code correctly, can you please show me how?

Thank you a lot in advance.

ratal commented 7 years ago

_convertMatlabName is an example of function that is cleaning name from not allowed characters., it can be introduced in the code to avoid this issue but this is dirty patch. ':' character is allowed for a dict key. But as I do not see where is this error in the code (your picture is not complete) and no complete information either from donvicario, I cannot troubleshot. Could you please send your snapshot again or inform the line number and in which file for the final error?

tivoodoo commented 7 years ago

Thank you a lot for your fast reply and also sorry for my late. Here is the full trace: 2017-05-09 10_16_22-mdfreader_python_test

ratal commented 7 years ago

Thanks for the update. It is more clear now. Actually, recarray uses python identifiers, which has not allowed characters. I implemented a new function in mdf.py module shared in all modules to declare only the recarray format. --> it should solve your issue, please try.

tivoodoo commented 7 years ago

It worked! Thank you a lot!!!