logo       

Re: how to determine Mac OS X version: msg#00149

python.apple

Subject: Re: how to determine Mac OS X version


On 28-mei-04, at 8:32, brad.allen@xxxxxxxxxx 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 yet:-).

"sysv" works all the way back to, uhm, System 7.0 I think.
--
Jack Jansen, <Jack.Jansen@xxxxxx>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma Goldman

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/pythonmac-sig
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise