I was wondering what is the best way that I can grab the year of the Maya version and just the year that I am using - eg. 2012, 2014 etc?--I know that there is a command - cmds.about(v=True) which returns me 'Extension for Autodesk Maya 2014 Service Pack 2' but any ideas in which I can improve on it?
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7c3cafbc-6b19-47b0-b864-9d541bc3e7c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Here is one way to use regex. it’s not super elegant, but it gets the job done.
hope this helps.
import re
# get combinations of 4 numbers in a row like 2014, 2015, 2016, etc.
pattern = re.compile(r'''.*(\d{4})''')
res = pattern.search(mc.about(v=True))
if res.groups():
print("version {0}".format(res.groups()[0]))
else:
print("this doesn't give me a version")
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABPXW4gS5yP4OzZp%3D8EW5zdqLTg5ZX44%3D9gHw3_j%3DMgVM-tpvQ%40mail.gmail.com.
Mel command:
getApplicationVersionAsFloat
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABPXW4gS5yP4OzZp%3D8EW5zdqLTg5ZX44%3D9gHw3_j%3DMgVM-tpvQ%40mail.gmail.com.
In maya 2016 it gives me this# Result: u'2015' #
??
On Tuesday, July 12, 2016 at 10:11:17 AM UTC+4:30, Justin Israel wrote:
Does the cutstring give you anything consistent?cmds.about(c=True)[:4]On my machine, the year is the first 4 characters.
On Mon, Jul 11, 2016 at 3:43 PM likage <dissid...@gmail.com> wrote:
I was wondering what is the best way that I can grab the year of the Maya version and just the year that I am using - eg. 2012, 2014 etc?--I know that there is a command - cmds.about(v=True) which returns me 'Extension for Autodesk Maya 2014 Service Pack 2' but any ideas in which I can improve on it?
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
cmds.about(c=True) >> # Result: u'201502261600-953408' #
On Tuesday, July 12, 2016 at 10:11:17 AM UTC+4:30, Justin Israel wrote:
Does the cutstring give you anything consistent?cmds.about(c=True)[:4]On my machine, the year is the first 4 characters.
On Mon, Jul 11, 2016 at 3:43 PM likage <dissid...@gmail.com> wrote:
I was wondering what is the best way that I can grab the year of the Maya version and just the year that I am using - eg. 2012, 2014 etc?--I know that there is a command - cmds.about(v=True) which returns me 'Extension for Autodesk Maya 2014 Service Pack 2' but any ideas in which I can improve on it?
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.