This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: MacOS.Error for platform.mac_ver under OS X
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lemburg Nosy List: brett.cannon, jackjansen, lemburg
Priority: normal Keywords:

Created on 2003-07-30 20:20 by brett.cannon, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Messages (5)
msg17483 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-07-30 20:20
>>> platform.mac_ver()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/Users/drifty/cvs_code/lib/python2.3/platform.py", 
line 563, in mac_ver
    sysv,sysu,sysa = _mac_ver_lookup(('sysv','sysu','sysa'))
  File "/Users/drifty/cvs_code/lib/python2.3/platform.py", 
line 532, in _mac_ver_lookup
    append(gestalt(selector))
MacOS.Error: (-5551, 'undefined selector was passed to 
Gestalt')


This is on an OS X 10.2.6 system.

Any chance this is because I compiled with --enable-
unicode=ucs4 ?
msg17484 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-08-01 09:40
Logged In: YES 
user_id=45365

The problem is not with your ucs4 build, this call always fails 
under MacOSX. The problem is that the 'sysu' gestalt selector isn't 
available under OSX.

The code in _mac_ver_lookup does a try/except on RuntimeError 
around the call to gestalt, but I don't remember MacOS.Error ever 
being a subclass of RuntimeError. Currently MacOS.Error is in a 
class by itself, it should probably be an OSError subclass, but that 
still won't fix this.

I suggest doing the try/except on MacOS.Error.
msg17485 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2003-08-01 11:40
Logged In: YES 
user_id=38388

Catching MacOS.Error doesn't help much: if 'sysu' is not
available on MacOSX, then I need the system information 
from somewhere else. Any hints ? (don't have a MacOSX
to test on, so it's up to you to provide the necessary 
information or patch :-)

Thanks.
msg17486 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-08-08 02:28
Logged In: YES 
user_id=357491

I have no clue how to get the info but I can help test anything.  I 
think Jack is going to have to be the big helper in terms of how to 
patch this one.
msg17487 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-10-14 22:30
Logged In: YES 
user_id=357491

Well, this is working for me under 2.4 (still busted under 2.3, 
though).  But a quick check of the cvs logs and it turns out Jack 
wanted this backported but just didn't get to it.

So I will go ahead and backport the changes from 1.6 and 1.7 to 
release23-maint.
History
Date User Action Args
2022-04-10 16:10:21adminsetgithub: 38977
2003-07-30 20:20:50brett.cannoncreate