Issue 2188: Documentation hint about disabling proxy detection.
[python.git] / Doc / library / macos.rst
blob543f8686cff520f7c168d7f1193777d2e2e5481e
2 :mod:`MacOS` --- Access to Mac OS interpreter features
3 ======================================================
5 .. module:: MacOS
6    :platform: Mac
7    :synopsis: Access to Mac OS-specific interpreter features.
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 Note the capitalization of the module name; this is a historical artifact.
17 .. data:: runtimemodel
19    Always ``'macho'``, from Python 2.4 on. In earlier versions of Python the value
20    could also be ``'ppc'`` for the classic Mac OS 8 runtime model or ``'carbon'``
21    for the Mac OS 9 runtime model.
24 .. data:: linkmodel
26    The way the interpreter has been linked. As extension modules may be
27    incompatible between linking models, packages could use this information to give
28    more decent error messages. The value is one of ``'static'`` for a statically
29    linked Python, ``'framework'`` for Python in a Mac OS X framework, ``'shared'``
30    for Python in a standard Unix shared library. Older Pythons could also have the
31    value ``'cfm'`` for Mac OS 9-compatible Python.
34 .. exception:: Error
36    .. index:: module: macerrors
38    This exception is raised on MacOS generated errors, either from functions in
39    this module or from other mac-specific modules like the toolbox interfaces. The
40    arguments are the integer error code (the :cdata:`OSErr` value) and a textual
41    description of the error code. Symbolic names for all known error codes are
42    defined in the standard module :mod:`macerrors`.
45 .. function:: GetErrorString(errno)
47    Return the textual description of MacOS error code *errno*.
50 .. function:: DebugStr(message [, object])
52    On Mac OS X the string is simply printed to stderr (on older Mac OS systems more
53    elaborate functionality was available), but it provides a convenient location to
54    attach a breakpoint in a low-level debugger like :program:`gdb`.
57 .. function:: SysBeep()
59    Ring the bell.
62 .. function:: GetTicks()
64    Get the number of clock ticks (1/60th of a second) since system boot.
67 .. function:: GetCreatorAndType(file)
69    Return the file creator and file type as two four-character strings. The *file*
70    parameter can be a pathname or an ``FSSpec`` or  ``FSRef`` object.
73 .. function:: SetCreatorAndType(file, creator, type)
75    Set the file creator and file type. The *file* parameter can be a pathname or an
76    ``FSSpec`` or  ``FSRef`` object. *creator* and *type* must be four character
77    strings.
80 .. function:: openrf(name [, mode])
82    Open the resource fork of a file. Arguments are the same as for the built-in
83    function :func:`open`. The object returned has file-like semantics, but it is
84    not a Python file object, so there may be subtle differences.
87 .. function:: WMAvailable()
89    Checks whether the current process has access to the window manager. The method
90    will return ``False`` if the window manager is not available, for instance when
91    running on Mac OS X Server or when logged in via ssh, or when the current
92    interpreter is not running from a fullblown application bundle. A script runs
93    from an application bundle either when it has been started with
94    :program:`pythonw` instead of :program:`python` or when running  as an applet.