MWorks python: version attribute?

mhisted's Avatar


09 Aug, 2021 01:43 PM

Hi Chris,

My version of the MWorks Python module doesn't have a way that I could find to check the MWorks version. Perhaps you can add a __version__ attribute if something like this doesn't already exist?


  1. Support Staff 1 Posted by Christopher Sta... on 09 Aug, 2021 01:54 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    You're correct that the Python package doesn't include the MWorks version at present. There is a way to get this info that we discussed previously. However, having a __version__ attribute would obviously be easier. I'll add that.


  2. 2 Posted by mhisted on 09 Aug, 2021 04:00 PM

    mhisted's Avatar

    That sounds great. Thanks.

  3. Christopher Stawarz closed this discussion on 31 May, 2022 05:45 PM.

  4. Christopher Stawarz re-opened this discussion on 13 Jun, 2022 03:48 PM

  5. Support Staff 3 Posted by Christopher Sta... on 13 Jun, 2022 03:48 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    As of the current nightly build, the Python mworks package has a __version__ attribute:

    >>> import mworks
    >>> mworks.__version__

    There's also a get_version function that returns both the version number and the build date in numeric form:

    >>> mworks.get_version()
    ((0, 12), (2022, 6, 2))

    Finally, there's a require_version function that will assert that the version number and/or build date are at least as new as ones you specify:

    >>> mworks.require_version(min_version=(0,11))
    >>> mworks.require_version(min_version=(0,12))
    >>> mworks.require_version(min_version=(0,13))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Library/Application Support/MWorks/Scripting/Python/mworks/", line 31, in require_version
        assert version >= min_version, 'MWorks version < %s' % (min_version,)
    AssertionError: MWorks version < (0, 13)
    >>> mworks.require_version(min_build_date=(2022,6,1))
    >>> mworks.require_version(min_build_date=(2022,6,2))
    >>> mworks.require_version(min_build_date=(2022,6,3))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Library/Application Support/MWorks/Scripting/Python/mworks/", line 32, in require_version
        assert build_date >= min_build_date, ('MWorks build date < %s' %
    AssertionError: MWorks build date < (2022, 6, 3)
    >>> mworks.require_version(min_version=(0,12), min_build_date=(2022,6,2))


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac