View Full Version : Major.minor product information retrieval

02-13-2013, 03:44 PM
I can't find an equivalent of this in the Python documentation. Is there a helper function to retrieve the major and minor version information from LW in Python?


03-01-2013, 10:54 PM
Here is the process I followed to get the values:

set large value on the python console Max Line

import lwsdk
help(lwsdk) - this may take a while

save the log

lwhost.h contains

#define LWINF_GETMAJOR(x) (((x) & LWINF_MAJORREV) >> 20)
#define LWINF_GETMINOR(x) (((x) & LWINF_MINORREV) >> 16)
#define LWINF_GETBUILD(x) (((x) & LWINF_BUILD) >> 4)

search for 'LWINF_' in the console log and you can find

search for 'product' will find product_info which looks a little bit like prodinfo so guess that's the one to use

prodinfo = ( unsigned int ) global( LWPRODUCTINFO_GLOBAL,

the resulting python code fragment is

product = lwsdk.product_info() & lwsdk.LWINF_PRODUCT
print 'product is %d' % product

build = (lwsdk.product_info() & lwsdk.LWINF_BUILD) >> 4
print 'build is %d' % build
major = (lwsdk.product_info() & lwsdk.LWINF_MAJORREV) >> 20
print 'major is %d' % major
minor = (lwsdk.product_info() & lwsdk.LWINF_MINORREV) >> 16
print 'minor is %d' % minor
My result is product = 1, build = 2519, major = 11, minor = 5. Don't know if these numbers are correct or not.
I hope this helps. I wanted to formalize a method of finding things like this but it still turned into a kind of bread crumb trail.

03-05-2013, 04:35 PM
Yes, thanks. I got a similar reply recently from NT and forgot to update this thread. I'm somewhat surprised that there isn't a wrapped function with the convenience of hostVersion() from LScript, but I guess that's the price you pay for an SDK-like Python implementation. Some convenience functions wouldn't hurt, though :)

At the moment, my Passport port is halted as the current code, although passing the PCore sanity check, results in Layout just crashing after the panel is displayed. The crash doesn't really help me figure out what's going wrong, and I'm rather surprised that Python code can crash LW like this. I've filed a bug report and am awaiting a response. It's very likely to be my incompetence, but it was rare that LScript would cause the application to totally crash - you'd usually get a more-or-less helpful error message that gave some insight into what was fouled up.

03-14-2013, 10:09 AM
thanks for the insight on your process clinton. :thumbsup: