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?
thanks,
Mark
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?
thanks,
Mark
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.
Cheers,
Chris
That sounds great. Thanks.
Hi Mark,
As of the current nightly build, the Python mworks package has a __version__
attribute:
>>> import mworks
>>> mworks.__version__
'0.12.dev'
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/__init__.py", 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/__init__.py", 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))
Cheers,
Chris
@histed This issue has an update, too, in case you haven’t seen it.
Great - thank you! I’ll test this.