[Pythonmac-SIG] how to determine Mac OS X version
Jack.Jansen at cwi.nl
Fri May 28 05:03:56 EDT 2004
On 28-mei-04, at 8:32, brad.allen at omsdal.com wrote:
> I tried platform.mac_ver(), but this seems to be broken. Google turns
> up various bug reports on this function.
I don't fully remember whether something was changed for Python 2.3,
but mac_ver() works nicely for me (MacPython 2.3, MacOSX 10.3). What
exactly is the problem you're having?
But anyway, if it doesn't work for you the solution is to use the
underlying gestalt call:
>>> import gestalt
>>> print hex(gestalt.gestalt('sysv'))
the "sysv" version of gestalt should be interpreted as an 8-bit BCD
value followed by 2 4-bit values (which prints out nicely in hex). So
0x1033 means 10.3.3 (not 16.3.3, as MacOSXVI isn't even on the horizon
"sysv" works all the way back to, uhm, System 7.0 I think.
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2086 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040528/e3ec58a6/smime-0001.bin
More information about the Pythonmac-SIG