ratal / mdfreader

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

[Errno 22] Invalid argument when reading a mdf file #19

Closed obust closed 8 years ago

obust commented 8 years ago

I am trying to do the simplest thing: loading a mdf file as follows

yop=mdfreader.mdf('myfile.mdf')

but I get the same error even though I tried with 3 different files

myfile.mdf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mdfreader/mdf.py", line 106, in __init__
    self.read(fileName, channelList=channelList, convertAfterRead=convertAfterRead, filterChannelNames=filterChannelNames)
  File "mdfreader/mdfreader.py", line 341, in read
    info = mdfinfo(self.fileName, filterChannelNames)
  File "mdfreader/mdfreader.py", line 147, in __init__
    self.readinfo(fileName, filterChannelNames)
  File "mdfreader/mdfreader.py", line 177, in readinfo
    self.update(info4(None, fid))
  File "mdfreader/mdfinfo4.py", line 830, in __init__
    self.readinfo(fid)
  File "mdfreader/mdfinfo4.py", line 844, in readinfo
    self['HDBlock'].update(HDBlock(fid))
  File "mdfreader/mdfinfo4.py", line 218, in __init__
    self['Comment'] = CommentBlock(fid, self['hd_md_comment'], 'HD')
  File "mdfreader/mdfinfo4.py", line 278, in __init__
    self.loadHeader(fid, pointer)
  File "mdfreader/mdfinfo4.py", line 84, in loadHeader
    fid.seek(pointer)
IOError: [Errno 22] Invalid argument

I just want to convert the file to another format but I can't even open it. How is it that I cannot do the simplest thing ? Please any help would be appreciated

ratal commented 8 years ago

From the traceback, it seems pointer to a comment in your header file is not correct. This ispretty basic stuff, I do not really see why there is problem, first time so far. Which software generated these files ? I see two approaches to support you :

  1. you download mdfvalidator from vector site and confirm health of your file
  2. you send me your file if there no confidentiality issue and I can troubleshoot
obust commented 8 years ago

Unfortunately I have no information regarding the original software.

  1. Also I am on a unix system and therefore cannot install mdfvalidator or any other basic tools that can handle mdf files. This is the reason why I'd like to convert the file.
  2. I cannot send you my mdf file, however I also tried with the two mdf files from this thread http://www.telerik.com/forums/where-to-download-northwind-mdf-and-telerik-mdf and got the same result.

Thank you in advance for your help

ratal commented 8 years ago
  1. I am using linux and got mdfvalidator working with wine without issues.
  2. I will with the files from your link and keep you informed or track changes on github
ratal commented 8 years ago

I checked and those files are not complying to ASAM MDF standard, these are database dump files, you are try to use the wrong tool.