Read a Weidmuller File and get data from it

23 Views Asked by At

I have a file, created with the program "M-Print Pro, for Weidmuller". It has the file extension ".mpc" The file description given by the program is "Files with M-Print PRO contents"

This is an example of what it looks like via the program:

enter image description here

Now, I tried to look for a Python library to read the file, but unfortunately I didn't find any, since that kind of extension is commonly used for Musepack audio.

At this point, I simply tried opening it with:

r = open("C:/Users/Acer/Desktop/E3611310/CABLAGGIO.mpc", "r")
print(r.read())

What I get is the following error:

return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 188: character maps to <undefined>

I tried adding encoding="utf8", but still I get an error::

File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x84 in position 10: invalid start byte

What I'm trying to do are two, namely being able to read and recover the data of this type of file, and being able to create a similar file with new data.

Do you have any ideas on how I could solve it? Thank you all

1

There are 1 best solutions below

0
independent_bit1256 On

As far as I can tell, .mpc is a proprietary file format of that company. I wasn't able to find any documentation or specifications about that file format.

Due to your problem I would suggest that the .mpc file format isn't saved as charcters with utf-8 encoding (maybe no encoding at all..., could be their own encoding or bytewise). As always when proprietary file formats are involved I the only suggestions I can give you are:

  1. If you have a lot of time you need to manually decode the file format (Unfortunately I don't think that is possible...). I would not recommend that, as the company can literally change it completely at any time!
  2. Switch to a standardized file format (my suggestion!). However this is not alwys possible (I don't know if there is one in your specific case)
  3. Use the proprietary software which is intended to work with the proprietary file format (obviously that's the reason for companies to use proprietary file formats...)