[Pythonmac-SIG] how to determine Mac OS X version

Ronald Oussoren ronaldoussoren at mac.com
Fri May 28 13:37:19 EDT 2004


On 28-mei-04, at 13:23, Jim Tittsler wrote:

> On May 28, 2004, at 18:03, Jack Jansen wrote:
>> 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?
>
> Using Apple's Python 2.3 on 10.3.4, mac_ver() fails for me:
>
> >>> import platform
> >>> print platform.mac_ver()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File  
> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/platform.py", line 563, in mac_ver
>     sysv,sysu,sysa = _mac_ver_lookup(('sysv','sysu','sysa'))
>   File  
> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/platform.py", line 532, in _mac_ver_lookup
>     append(gestalt(selector))
> MacOS.Error: (-5551, 'undefined selector was passed to Gestalt')
>
> My machine doesn't like to do gestalt.gestalt('sysu') (and raises the  
> wrong exception for platform.py's  _mac_ver_lookup()?).

I'm seeing the same thing on 10.3.3 and 10.3.4. In both cases 'sysu' is  
the culprit.

This is a known problem: http://www.python.org/sf/780461 and seems to  
be fixed in recent versions of python.

Ronald

--
X|support bv            http://www.xsupport.nl/
T:  +31 610271479       F:  +31 204416173




More information about the Pythonmac-SIG mailing list