[Pythonmac-SIG] way to tell what platform python code executing on?
Jack Jansen
Jack.Jansen@oratrix.com
Fri, 18 Oct 2002 22:11:20 +0200
On vrijdag, okt 18, 2002, at 21:22 Europe/Amsterdam, Magladry, Stephen
wrote:
> I have a Python utility file that need to be run both under Mach-o
> Python
> and Mac Python. This file processes files from a directory. So I
> currently
> have a gross hack
>
>
> carbon = 1
> if carbon : #Mac
> dir = "Mac OS X:Applications:Python 2.2.1"
> else: #Mach-o
> dir = "/Applications/Python 2.2.1"
You want MacOS.runtimemodel. The values can be "classic" (non-Carbon
OS9 MacPython), "carbon" (OS9 or OSX Carbon MacPython) or "macho" (OSX
unix-Python).
And if you can't import the MacOS module then you're not on a Mac:-)
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma
Goldman -