Issue #5170: Fixed regression caused when fixing #5768.
[python.git] / Doc / library / macos.rst
blob526fb3ce12e5558dcebeb448290f8c090c87dffc
1 :mod:`MacOS` --- Access to Mac OS interpreter features
2 ======================================================
4 .. module:: MacOS
5    :platform: Mac
6    :synopsis: Access to Mac OS-specific interpreter features.
7    :deprecated:
10 This module provides access to MacOS specific functionality in the Python
11 interpreter, such as how the interpreter eventloop functions and the like. Use
12 with care.
14 .. warning::
16    This module is removed in 3.0.
18 Note the capitalization of the module name; this is a historical artifact.
21 .. data:: runtimemodel
23    Always ``'macho'``, from Python 2.4 on. In earlier versions of Python the value
24    could also be ``'ppc'`` for the classic Mac OS 8 runtime model or ``'carbon'``
25    for the Mac OS 9 runtime model.
28 .. data:: linkmodel
30    The way the interpreter has been linked. As extension modules may be
31    incompatible between linking models, packages could use this information to give
32    more decent error messages. The value is one of ``'static'`` for a statically
33    linked Python, ``'framework'`` for Python in a Mac OS X framework, ``'shared'``
34    for Python in a standard Unix shared library. Older Pythons could also have the
35    value ``'cfm'`` for Mac OS 9-compatible Python.
38 .. exception:: Error
40    .. index:: module: macerrors
42    This exception is raised on MacOS generated errors, either from functions in
43    this module or from other mac-specific modules like the toolbox interfaces. The
44    arguments are the integer error code (the :cdata:`OSErr` value) and a textual
45    description of the error code. Symbolic names for all known error codes are
46    defined in the standard module :mod:`macerrors`.
49 .. function:: GetErrorString(errno)
51    Return the textual description of MacOS error code *errno*.
54 .. function:: DebugStr(message [, object])
56    On Mac OS X the string is simply printed to stderr (on older Mac OS systems more
57    elaborate functionality was available), but it provides a convenient location to
58    attach a breakpoint in a low-level debugger like :program:`gdb`.
60    .. note::
62       Not available in 64-bit mode.
65 .. function:: SysBeep()
67    Ring the bell.
69    .. note::
71       Not available in 64-bit mode.
74 .. function:: GetTicks()
76    Get the number of clock ticks (1/60th of a second) since system boot.
79 .. function:: GetCreatorAndType(file)
81    Return the file creator and file type as two four-character strings. The *file*
82    parameter can be a pathname or an ``FSSpec`` or  ``FSRef`` object.
84    .. note::
86       It is not possible to use an ``FSSpec`` in 64-bit mode.
89 .. function:: SetCreatorAndType(file, creator, type)
91    Set the file creator and file type. The *file* parameter can be a pathname or an
92    ``FSSpec`` or  ``FSRef`` object. *creator* and *type* must be four character
93    strings.
95    .. note::
97       It is not possible to use an ``FSSpec`` in 64-bit mode.
99 .. function:: openrf(name [, mode])
101    Open the resource fork of a file. Arguments are the same as for the built-in
102    function :func:`open`. The object returned has file-like semantics, but it is
103    not a Python file object, so there may be subtle differences.
106 .. function:: WMAvailable()
108    Checks whether the current process has access to the window manager. The method
109    will return ``False`` if the window manager is not available, for instance when
110    running on Mac OS X Server or when logged in via ssh, or when the current
111    interpreter is not running from a fullblown application bundle. A script runs
112    from an application bundle either when it has been started with
113    :program:`pythonw` instead of :program:`python` or when running  as an applet.
115 .. function:: splash([resourceid])
117    Opens a splash screen by resource id. Use resourceid ``0`` to close
118    the splash screen.
120    .. note::
122       Not available in 64-bit mode.