# Mworks library unpacking on linux system

**URL:** <https://mworks.discourse.group/t/mworks-library-unpacking-on-linux-system/239>\
**Category:** Support\
**Created:** [July 18, 2019, 1:48pm UTC](https://mworks.discourse.group/t/mworks-library-unpacking-on-linux-system/239 "2019-07-18T13:48:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 18, 2019, 1:48pm UTC](https://mworks.discourse.group/t/mworks-library-unpacking-on-linux-system/239/1 "2019-07-18T13:48:06Z")

</div>

Hi Chris,

I’m trying to unpack mwel2 files, using either MATLAB or python, on a non-OSX machine. The mworks library that comes shipped with the app is compiled in OS X – any chance you can provide something for a linux system?

Alternatively, I see that we can use the msgpack module to directly unpack mwel2 files, but I don’t see how to get the variable names (rather than just the integer code). Can you advise on this?

Let me know, and thanks in advance,  
Rishi

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 18, 2019, 2:05pm UTC](https://mworks.discourse.group/t/mworks-library-unpacking-on-linux-system/239/2 "2019-07-18T14:05:56Z")

</div>

Hi Rishi,

> The mworks library that comes shipped with the app is compiled in OS X – any chance you can provide something for a linux system?

Sorry, but MWorks doesn’t support Linux.

> Alternatively, I see that we can use the msgpack module to directly unpack mwel2 files, but I don’t see how to get the variable names (rather than just the integer code). Can you advise on this?

You’re referring to [this Python code](https://mworks.github.io/documentation/latest/reference/event_file_format/current.html#example-code), right?

You need to extract the variable codec from the event file. The codec has [event code zero](https://mworks.github.io/documentation/latest/reference/sysvars.html#system-event-codes), which conveniently means it’s the first event in an MWK2 file. Here’s how you can use the codec to create a simple dictionary mapping integer codes to variable names:

```
code_to_name = {}
with MWK2Reader('my_data.mwk2') as event_file:
    for code, time, data in event_file:
        if code == 0 and not code_to_name:
            code_to_name = dict((c, data[c]['tagname']) for c in data)
        # Continue event processing
        ...

```

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 8:48pm UTC](https://mworks.discourse.group/t/mworks-library-unpacking-on-linux-system/239/3 "2022-07-19T20:48:19Z")

</div>


