mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Update references specifying "Macintosh" to mean OS X semantics and not Mac OS
9. Applies patch #1095802. Thanks Jack Jansen.
This commit is contained in:
parent
22c0706a58
commit
7706c2da14
17 changed files with 191 additions and 622 deletions
|
|
@ -239,9 +239,8 @@
|
||||||
program name (set by \cfunction{Py_SetProgramName()} above) and some
|
program name (set by \cfunction{Py_SetProgramName()} above) and some
|
||||||
environment variables. The returned string consists of a series of
|
environment variables. The returned string consists of a series of
|
||||||
directory names separated by a platform dependent delimiter
|
directory names separated by a platform dependent delimiter
|
||||||
character. The delimiter character is \character{:} on \UNIX,
|
character. The delimiter character is \character{:} on \UNIX and Mac OS X,
|
||||||
\character{;} on Windows, and \character{\e n} (the \ASCII{}
|
\character{;} on Windows. The returned string points into
|
||||||
newline character) on Macintosh. The returned string points into
|
|
||||||
static storage; the caller should not modify its value. The value
|
static storage; the caller should not modify its value. The value
|
||||||
is available to Python code as the list
|
is available to Python code as the list
|
||||||
\code{sys.path}\withsubitem{(in module sys)}{\ttindex{path}}, which
|
\code{sys.path}\withsubitem{(in module sys)}{\ttindex{path}}, which
|
||||||
|
|
@ -272,7 +271,7 @@
|
||||||
this is formed from the ``official'' name of the operating system,
|
this is formed from the ``official'' name of the operating system,
|
||||||
converted to lower case, followed by the major revision number;
|
converted to lower case, followed by the major revision number;
|
||||||
e.g., for Solaris 2.x, which is also known as SunOS 5.x, the value
|
e.g., for Solaris 2.x, which is also known as SunOS 5.x, the value
|
||||||
is \code{'sunos5'}. On Macintosh, it is \code{'mac'}. On Windows,
|
is \code{'sunos5'}. On Mac OS X, it is \code{'darwin'}. On Windows,
|
||||||
it is \code{'win'}. The returned string points into static storage;
|
it is \code{'win'}. The returned string points into static storage;
|
||||||
the caller should not modify its value. The value is available to
|
the caller should not modify its value. The value is available to
|
||||||
Python code as \code{sys.platform}.
|
Python code as \code{sys.platform}.
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ values from C values.
|
||||||
Return true when the interpreter runs out of stack space. This is a
|
Return true when the interpreter runs out of stack space. This is a
|
||||||
reliable check, but is only available when \constant{USE_STACKCHECK}
|
reliable check, but is only available when \constant{USE_STACKCHECK}
|
||||||
is defined (currently on Windows using the Microsoft Visual \Cpp{}
|
is defined (currently on Windows using the Microsoft Visual \Cpp{}
|
||||||
compiler and on the Macintosh). \constant{USE_CHECKSTACK} will be
|
compiler). \constant{USE_CHECKSTACK} will be
|
||||||
defined automatically; you should never change the definition in
|
defined automatically; you should never change the definition in
|
||||||
your own code.
|
your own code.
|
||||||
\end{cfuncdesc}
|
\end{cfuncdesc}
|
||||||
|
|
|
||||||
12
Doc/dist/dist.tex
vendored
12
Doc/dist/dist.tex
vendored
|
|
@ -298,7 +298,7 @@ platform-neutral representation into whatever is appropriate on your
|
||||||
current platform before actually using the pathname. This makes your
|
current platform before actually using the pathname. This makes your
|
||||||
setup script portable across operating systems, which of course is one
|
setup script portable across operating systems, which of course is one
|
||||||
of the major goals of the Distutils. In this spirit, all pathnames in
|
of the major goals of the Distutils. In this spirit, all pathnames in
|
||||||
this document are slash-separated. (Mac OS programmers should keep in
|
this document are slash-separated. (Mac OS 9 programmers should keep in
|
||||||
mind that the \emph{absence} of a leading slash indicates a relative
|
mind that the \emph{absence} of a leading slash indicates a relative
|
||||||
path, the opposite of the Mac OS convention with colons.)
|
path, the opposite of the Mac OS convention with colons.)
|
||||||
|
|
||||||
|
|
@ -1021,7 +1021,6 @@ python setup.py sdist
|
||||||
script or config file), \command{sdist} creates the archive of the
|
script or config file), \command{sdist} creates the archive of the
|
||||||
default format for the current platform. The default format is a gzip'ed
|
default format for the current platform. The default format is a gzip'ed
|
||||||
tar file (\file{.tar.gz}) on \UNIX, and ZIP file on Windows.
|
tar file (\file{.tar.gz}) on \UNIX, and ZIP file on Windows.
|
||||||
\XXX{no Mac OS support here}
|
|
||||||
|
|
||||||
You can specify as many formats as you like using the
|
You can specify as many formats as you like using the
|
||||||
\longprogramopt{formats} option, for example:
|
\longprogramopt{formats} option, for example:
|
||||||
|
|
@ -2059,9 +2058,9 @@ regular filename character, and \code{[\var{range}]} matches any of the
|
||||||
characters in \var{range} (e.g., \code{a-z}, \code{a-zA-Z},
|
characters in \var{range} (e.g., \code{a-z}, \code{a-zA-Z},
|
||||||
\code{a-f0-9\_.}). The definition of ``regular filename character'' is
|
\code{a-f0-9\_.}). The definition of ``regular filename character'' is
|
||||||
platform-specific: on \UNIX{} it is anything except slash; on Windows
|
platform-specific: on \UNIX{} it is anything except slash; on Windows
|
||||||
anything except backslash or colon; on Mac OS anything except colon.
|
anything except backslash or colon; on Mac OS 9 anything except colon.
|
||||||
|
|
||||||
\XXX{Windows and Mac OS support not there yet}
|
\XXX{Windows support not there yet}
|
||||||
|
|
||||||
|
|
||||||
%\section{Creating a built distribution: the
|
%\section{Creating a built distribution: the
|
||||||
|
|
@ -2759,7 +2758,8 @@ This module provides the EMXCCompiler class, a subclass of \class{UnixCCompiler}
|
||||||
\modulesynopsis{Metrowerks CodeWarrior support}
|
\modulesynopsis{Metrowerks CodeWarrior support}
|
||||||
|
|
||||||
Contains \class{MWerksCompiler}, an implementation of the abstract
|
Contains \class{MWerksCompiler}, an implementation of the abstract
|
||||||
\class{CCompiler} class for MetroWerks CodeWarrior on the Macintosh. Needs work to support CW on Windows.
|
\class{CCompiler} class for MetroWerks CodeWarrior on the pre-Mac OS X Macintosh.
|
||||||
|
Needs work to support CW on Windows or Mac OS X.
|
||||||
|
|
||||||
|
|
||||||
%\subsection{Utility modules}
|
%\subsection{Utility modules}
|
||||||
|
|
@ -2999,7 +2999,7 @@ starts or ends with a slash.
|
||||||
Return \var{pathname} with \var{new_root} prepended. If \var{pathname} is
|
Return \var{pathname} with \var{new_root} prepended. If \var{pathname} is
|
||||||
relative, this is equivalent to \samp{os.path.join(new_root,pathname)}
|
relative, this is equivalent to \samp{os.path.join(new_root,pathname)}
|
||||||
Otherwise, it requires making \var{pathname} relative and then joining the
|
Otherwise, it requires making \var{pathname} relative and then joining the
|
||||||
two, which is tricky on DOS/Windows and Mac OS.
|
two, which is tricky on DOS/Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{check_environ}{}
|
\begin{funcdesc}{check_environ}{}
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,7 @@ called automatically unless there's an entry in the
|
||||||
\cdata{_PyImport_Inittab} table. The easiest way to handle this is to
|
\cdata{_PyImport_Inittab} table. The easiest way to handle this is to
|
||||||
statically initialize your statically-linked modules by directly
|
statically initialize your statically-linked modules by directly
|
||||||
calling \cfunction{initspam()} after the call to
|
calling \cfunction{initspam()} after the call to
|
||||||
\cfunction{Py_Initialize()} or \cfunction{PyMac_Initialize()}:
|
\cfunction{Py_Initialize()}:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
int
|
int
|
||||||
|
|
@ -426,7 +426,6 @@ system uses; see the chapters about building extension modules
|
||||||
(chapter \ref{building}) and additional information that pertains only
|
(chapter \ref{building}) and additional information that pertains only
|
||||||
to building on Windows (chapter \ref{building-on-windows}) for more
|
to building on Windows (chapter \ref{building-on-windows}) for more
|
||||||
information about this.
|
information about this.
|
||||||
% XXX Add information about Mac OS
|
|
||||||
|
|
||||||
If you can't use dynamic loading, or if you want to make your module a
|
If you can't use dynamic loading, or if you want to make your module a
|
||||||
permanent part of the Python interpreter, you will have to change the
|
permanent part of the Python interpreter, you will have to change the
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ python setup.py install
|
||||||
|
|
||||||
On \UNIX, you'd run this command from a shell prompt; on Windows, you
|
On \UNIX, you'd run this command from a shell prompt; on Windows, you
|
||||||
have to open a command prompt window (``DOS box'') and do it there; on
|
have to open a command prompt window (``DOS box'') and do it there; on
|
||||||
Mac OS, things are a tad more complicated (see below).
|
Mac OS X, you open a \command{Terminal} window to get a shell prompt.
|
||||||
|
|
||||||
|
|
||||||
\subsection{Platform variations}
|
\subsection{Platform variations}
|
||||||
|
|
@ -262,7 +262,8 @@ If you don't choose an installation directory---i.e., if you just run
|
||||||
\code{setup.py install}---then the \command{install} command installs to
|
\code{setup.py install}---then the \command{install} command installs to
|
||||||
the standard location for third-party Python modules. This location
|
the standard location for third-party Python modules. This location
|
||||||
varies by platform and by how you built/installed Python itself. On
|
varies by platform and by how you built/installed Python itself. On
|
||||||
\UNIX{} and Mac OS, it also depends on whether the module distribution
|
\UNIX{} (and Mac OS X, which is also Unix-based),
|
||||||
|
it also depends on whether the module distribution
|
||||||
being installed is pure Python or contains extensions (``non-pure''):
|
being installed is pure Python or contains extensions (``non-pure''):
|
||||||
\begin{tableiv}{l|l|l|c}{textrm}%
|
\begin{tableiv}{l|l|l|c}{textrm}%
|
||||||
{Platform}{Standard installation location}{Default value}{Notes}
|
{Platform}{Standard installation location}{Default value}{Notes}
|
||||||
|
|
@ -278,14 +279,6 @@ being installed is pure Python or contains extensions (``non-pure''):
|
||||||
{\filenq{\filevar{prefix}}}
|
{\filenq{\filevar{prefix}}}
|
||||||
{\filenq{C:\textbackslash{}Python}}
|
{\filenq{C:\textbackslash{}Python}}
|
||||||
{(2)}
|
{(2)}
|
||||||
\lineiv{Mac OS (pure)}
|
|
||||||
{\filenq{\filevar{prefix}:Lib:site-packages}}
|
|
||||||
{\filenq{Python:Lib:site-packages}}
|
|
||||||
{}
|
|
||||||
\lineiv{Mac OS (non-pure)}
|
|
||||||
{\filenq{\filevar{prefix}:Lib:site-packages}}
|
|
||||||
{\filenq{Python:Lib:site-packages}}
|
|
||||||
{}
|
|
||||||
\end{tableiv}
|
\end{tableiv}
|
||||||
|
|
||||||
\noindent Notes:
|
\noindent Notes:
|
||||||
|
|
@ -302,8 +295,8 @@ being installed is pure Python or contains extensions (``non-pure''):
|
||||||
|
|
||||||
\filevar{prefix} and \filevar{exec-prefix} stand for the directories
|
\filevar{prefix} and \filevar{exec-prefix} stand for the directories
|
||||||
that Python is installed to, and where it finds its libraries at
|
that Python is installed to, and where it finds its libraries at
|
||||||
run-time. They are always the same under Windows and Mac OS, and very
|
run-time. They are always the same under Windows, and very
|
||||||
often the same under \UNIX. You can find out what your Python
|
often the same under \UNIX and Mac OS X. You can find out what your Python
|
||||||
installation uses for \filevar{prefix} and \filevar{exec-prefix} by
|
installation uses for \filevar{prefix} and \filevar{exec-prefix} by
|
||||||
running Python in interactive mode and typing a few simple commands.
|
running Python in interactive mode and typing a few simple commands.
|
||||||
Under \UNIX, just type \code{python} at the shell prompt. Under
|
Under \UNIX, just type \code{python} at the shell prompt. Under
|
||||||
|
|
@ -658,7 +651,7 @@ environment variables, such as Mac OS 9, the configuration
|
||||||
variables supplied by the Distutils are the only ones you can use.)
|
variables supplied by the Distutils are the only ones you can use.)
|
||||||
See section~\ref{config-files} for details.
|
See section~\ref{config-files} for details.
|
||||||
|
|
||||||
% XXX need some Windows and Mac OS examples---when would custom
|
% XXX need some Windows examples---when would custom
|
||||||
% installation schemes be needed on those platforms?
|
% installation schemes be needed on those platforms?
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -764,7 +757,7 @@ apply, values from ``earlier'' files are overridden by ``later'' files.
|
||||||
\label{config-filenames}
|
\label{config-filenames}
|
||||||
|
|
||||||
The names and locations of the configuration files vary slightly across
|
The names and locations of the configuration files vary slightly across
|
||||||
platforms. On \UNIX, the three configuration files (in the order they
|
platforms. On \UNIX and Mac OS X, the three configuration files (in the order they
|
||||||
are processed) are:
|
are processed) are:
|
||||||
\begin{tableiii}{l|l|c}{textrm}
|
\begin{tableiii}{l|l|c}{textrm}
|
||||||
{Type of file}{Location and filename}{Notes}
|
{Type of file}{Location and filename}{Notes}
|
||||||
|
|
@ -773,7 +766,7 @@ are processed) are:
|
||||||
\lineiii{local}{\filenq{setup.cfg}}{(3)}
|
\lineiii{local}{\filenq{setup.cfg}}{(3)}
|
||||||
\end{tableiii}
|
\end{tableiii}
|
||||||
|
|
||||||
On Windows, the configuration files are:
|
And on Windows, the configuration files are:
|
||||||
\begin{tableiii}{l|l|c}{textrm}
|
\begin{tableiii}{l|l|c}{textrm}
|
||||||
{Type of file}{Location and filename}{Notes}
|
{Type of file}{Location and filename}{Notes}
|
||||||
\lineiii{system}{\filenq{\filevar{prefix}\textbackslash{}Lib\textbackslash{}distutils\textbackslash{}distutils.cfg}}{(4)}
|
\lineiii{system}{\filenq{\filevar{prefix}\textbackslash{}Lib\textbackslash{}distutils\textbackslash{}distutils.cfg}}{(4)}
|
||||||
|
|
@ -781,14 +774,6 @@ On Windows, the configuration files are:
|
||||||
\lineiii{local}{\filenq{setup.cfg}}{(3)}
|
\lineiii{local}{\filenq{setup.cfg}}{(3)}
|
||||||
\end{tableiii}
|
\end{tableiii}
|
||||||
|
|
||||||
And on Mac OS, they are:
|
|
||||||
\begin{tableiii}{l|l|c}{textrm}
|
|
||||||
{Type of file}{Location and filename}{Notes}
|
|
||||||
\lineiii{system}{\filenq{\filevar{prefix}:Lib:distutils:distutils.cfg}}{(6)}
|
|
||||||
\lineiii{personal}{N/A}{}
|
|
||||||
\lineiii{local}{\filenq{setup.cfg}}{(3)}
|
|
||||||
\end{tableiii}
|
|
||||||
|
|
||||||
\noindent Notes:
|
\noindent Notes:
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[(1)] Strictly speaking, the system-wide configuration file lives
|
\item[(1)] Strictly speaking, the system-wide configuration file lives
|
||||||
|
|
@ -818,9 +803,6 @@ And on Mac OS, they are:
|
||||||
defined, no personal configuration file will be found or used. (In
|
defined, no personal configuration file will be found or used. (In
|
||||||
other words, the Distutils make no attempt to guess your home
|
other words, the Distutils make no attempt to guess your home
|
||||||
directory on Windows.)
|
directory on Windows.)
|
||||||
\item[(6)] (See also notes (1) and (4).) The default installation
|
|
||||||
prefix is just \file{Python:}, so under Python 1.6 and later this is
|
|
||||||
normally\file{Python:Lib:distutils:distutils.cfg}.
|
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,8 @@ The module was found as dynamically loadable shared library.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{PY_RESOURCE}
|
\begin{datadesc}{PY_RESOURCE}
|
||||||
The module was found as a Macintosh resource. This value can only be
|
The module was found as a Mac OS 9 resource. This value can only be
|
||||||
returned on a Macintosh.
|
returned on a Mac OS 9 or earlier Macintosh.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{PKG_DIRECTORY}
|
\begin{datadesc}{PKG_DIRECTORY}
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ the command (encoded in the format specified for \function{wait()}) is
|
||||||
available as the return value of the \method{close()} method of the file
|
available as the return value of the \method{close()} method of the file
|
||||||
object, except that when the exit status is zero (termination without
|
object, except that when the exit status is zero (termination without
|
||||||
errors), \code{None} is returned.
|
errors), \code{None} is returned.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
|
|
||||||
\versionchanged[This function worked unreliably under Windows in
|
\versionchanged[This function worked unreliably under Windows in
|
||||||
earlier versions of Python. This was due to the use of the
|
earlier versions of Python. This was due to the use of the
|
||||||
|
|
@ -350,7 +350,7 @@ Availability: \UNIX, Windows.
|
||||||
Return a new file object opened in update mode (\samp{w+b}). The file
|
Return a new file object opened in update mode (\samp{w+b}). The file
|
||||||
has no directory entries associated with it and will be automatically
|
has no directory entries associated with it and will be automatically
|
||||||
deleted once there are no file descriptors for the file.
|
deleted once there are no file descriptors for the file.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -380,21 +380,21 @@ Issues}{popen2-flow-control.html}''
|
||||||
\begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}}
|
\begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}}
|
||||||
Executes \var{cmd} as a sub-process. Returns the file objects
|
Executes \var{cmd} as a sub-process. Returns the file objects
|
||||||
\code{(\var{child_stdin}, \var{child_stdout})}.
|
\code{(\var{child_stdin}, \var{child_stdout})}.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\versionadded{2.0}
|
\versionadded{2.0}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}}
|
\begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}}
|
||||||
Executes \var{cmd} as a sub-process. Returns the file objects
|
Executes \var{cmd} as a sub-process. Returns the file objects
|
||||||
\code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}.
|
\code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\versionadded{2.0}
|
\versionadded{2.0}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}}
|
\begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}}
|
||||||
Executes \var{cmd} as a sub-process. Returns the file objects
|
Executes \var{cmd} as a sub-process. Returns the file objects
|
||||||
\code{(\var{child_stdin}, \var{child_stdout_and_stderr})}.
|
\code{(\var{child_stdin}, \var{child_stdout_and_stderr})}.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\versionadded{2.0}
|
\versionadded{2.0}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
@ -434,7 +434,7 @@ Availability: Macintosh, \UNIX, Windows.
|
||||||
\begin{funcdesc}{dup2}{fd, fd2}
|
\begin{funcdesc}{dup2}{fd, fd2}
|
||||||
Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter
|
Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter
|
||||||
first if necessary.
|
first if necessary.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{fdatasync}{fd}
|
\begin{funcdesc}{fdatasync}{fd}
|
||||||
|
|
@ -453,7 +453,7 @@ known to the host operating system are given in the
|
||||||
\code{pathconf_names} dictionary. For configuration variables not
|
\code{pathconf_names} dictionary. For configuration variables not
|
||||||
included in that mapping, passing an integer for \var{name} is also
|
included in that mapping, passing an integer for \var{name} is also
|
||||||
accepted.
|
accepted.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
|
|
||||||
If \var{name} is a string and is not known, \exception{ValueError} is
|
If \var{name} is a string and is not known, \exception{ValueError} is
|
||||||
raised. If a specific value for \var{name} is not supported by the
|
raised. If a specific value for \var{name} is not supported by the
|
||||||
|
|
@ -464,7 +464,7 @@ error number.
|
||||||
|
|
||||||
\begin{funcdesc}{fstat}{fd}
|
\begin{funcdesc}{fstat}{fd}
|
||||||
Return status for file descriptor \var{fd}, like \function{stat()}.
|
Return status for file descriptor \var{fd}, like \function{stat()}.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{fstatvfs}{fd}
|
\begin{funcdesc}{fstatvfs}{fd}
|
||||||
|
|
@ -482,19 +482,19 @@ If you're starting with a Python file object \var{f}, first do
|
||||||
\code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno())},
|
\code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno())},
|
||||||
to ensure that all internal buffers associated with \var{f} are written
|
to ensure that all internal buffers associated with \var{f} are written
|
||||||
to disk.
|
to disk.
|
||||||
Availability: \UNIX, and Windows starting in 2.2.3.
|
Availability: Macintosh, \UNIX, and Windows starting in 2.2.3.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{ftruncate}{fd, length}
|
\begin{funcdesc}{ftruncate}{fd, length}
|
||||||
Truncate the file corresponding to file descriptor \var{fd},
|
Truncate the file corresponding to file descriptor \var{fd},
|
||||||
so that it is at most \var{length} bytes in size.
|
so that it is at most \var{length} bytes in size.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{isatty}{fd}
|
\begin{funcdesc}{isatty}{fd}
|
||||||
Return \code{True} if the file descriptor \var{fd} is open and
|
Return \code{True} if the file descriptor \var{fd} is open and
|
||||||
connected to a tty(-like) device, else \code{False}.
|
connected to a tty(-like) device, else \code{False}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{lseek}{fd, pos, how}
|
\begin{funcdesc}{lseek}{fd, pos, how}
|
||||||
|
|
@ -531,13 +531,13 @@ Open a new pseudo-terminal pair. Return a pair of file descriptors
|
||||||
\code{(\var{master}, \var{slave})} for the pty and the tty,
|
\code{(\var{master}, \var{slave})} for the pty and the tty,
|
||||||
respectively. For a (slightly) more portable approach, use the
|
respectively. For a (slightly) more portable approach, use the
|
||||||
\refmodule{pty}\refstmodindex{pty} module.
|
\refmodule{pty}\refstmodindex{pty} module.
|
||||||
Availability: Some flavors of \UNIX.
|
Availability: Macintosh, Some flavors of \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{pipe}{}
|
\begin{funcdesc}{pipe}{}
|
||||||
Create a pipe. Return a pair of file descriptors \code{(\var{r},
|
Create a pipe. Return a pair of file descriptors \code{(\var{r},
|
||||||
\var{w})} usable for reading and writing, respectively.
|
\var{w})} usable for reading and writing, respectively.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{read}{fd, n}
|
\begin{funcdesc}{read}{fd, n}
|
||||||
|
|
@ -560,21 +560,21 @@ built-in function \function{open()} or by \function{popen()} or
|
||||||
\begin{funcdesc}{tcgetpgrp}{fd}
|
\begin{funcdesc}{tcgetpgrp}{fd}
|
||||||
Return the process group associated with the terminal given by
|
Return the process group associated with the terminal given by
|
||||||
\var{fd} (an open file descriptor as returned by \function{open()}).
|
\var{fd} (an open file descriptor as returned by \function{open()}).
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{tcsetpgrp}{fd, pg}
|
\begin{funcdesc}{tcsetpgrp}{fd, pg}
|
||||||
Set the process group associated with the terminal given by
|
Set the process group associated with the terminal given by
|
||||||
\var{fd} (an open file descriptor as returned by \function{open()})
|
\var{fd} (an open file descriptor as returned by \function{open()})
|
||||||
to \var{pg}.
|
to \var{pg}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{ttyname}{fd}
|
\begin{funcdesc}{ttyname}{fd}
|
||||||
Return a string which specifies the terminal device associated with
|
Return a string which specifies the terminal device associated with
|
||||||
file-descriptor \var{fd}. If \var{fd} is not associated with a terminal
|
file-descriptor \var{fd}. If \var{fd} is not associated with a terminal
|
||||||
device, an exception is raised.
|
device, an exception is raised.
|
||||||
Availability: \UNIX.
|
Availability:Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{write}{fd, str}
|
\begin{funcdesc}{write}{fd, str}
|
||||||
|
|
@ -621,7 +621,7 @@ Availability: Macintosh, \UNIX.
|
||||||
\begin{datadesc}{O_BINARY}
|
\begin{datadesc}{O_BINARY}
|
||||||
Option for the \var{flag} argument to the \function{open()} function.
|
Option for the \var{flag} argument to the \function{open()} function.
|
||||||
This can be bit-wise OR'd together with those listed above.
|
This can be bit-wise OR'd together with those listed above.
|
||||||
Availability: Macintosh, Windows.
|
Availability: Windows.
|
||||||
% XXX need to check on the availability of this one.
|
% XXX need to check on the availability of this one.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
@ -657,7 +657,7 @@ one or more of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to
|
||||||
test permissions. Return \constant{True} if access is allowed,
|
test permissions. Return \constant{True} if access is allowed,
|
||||||
\constant{False} if not.
|
\constant{False} if not.
|
||||||
See the \UNIX{} man page \manpage{access}{2} for more information.
|
See the \UNIX{} man page \manpage{access}{2} for more information.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{datadesc}{F_OK}
|
\begin{datadesc}{F_OK}
|
||||||
|
|
@ -701,13 +701,13 @@ Availability: Macintosh, \UNIX, Windows.
|
||||||
|
|
||||||
\begin{funcdesc}{getcwdu}{}
|
\begin{funcdesc}{getcwdu}{}
|
||||||
Return a Unicode object representing the current working directory.
|
Return a Unicode object representing the current working directory.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{chroot}{path}
|
\begin{funcdesc}{chroot}{path}
|
||||||
Change the root directory of the current process to \var{path}.
|
Change the root directory of the current process to \var{path}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.2}
|
\versionadded{2.2}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
@ -736,25 +736,25 @@ Change the mode of \var{path} to the numeric \var{mode}.
|
||||||
\item \code{S_IWOTH}
|
\item \code{S_IWOTH}
|
||||||
\item \code{S_IXOTH}
|
\item \code{S_IXOTH}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{chown}{path, uid, gid}
|
\begin{funcdesc}{chown}{path, uid, gid}
|
||||||
Change the owner and group id of \var{path} to the numeric \var{uid}
|
Change the owner and group id of \var{path} to the numeric \var{uid}
|
||||||
and \var{gid}.
|
and \var{gid}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{lchown}{path, uid, gid}
|
\begin{funcdesc}{lchown}{path, uid, gid}
|
||||||
Change the owner and group id of \var{path} to the numeric \var{uid}
|
Change the owner and group id of \var{path} to the numeric \var{uid}
|
||||||
and gid. This function will not follow symbolic links.
|
and gid. This function will not follow symbolic links.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{link}{src, dst}
|
\begin{funcdesc}{link}{src, dst}
|
||||||
Create a hard link pointing to \var{src} named \var{dst}.
|
Create a hard link pointing to \var{src} named \var{dst}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{listdir}{path}
|
\begin{funcdesc}{listdir}{path}
|
||||||
|
|
@ -770,14 +770,14 @@ object, the result will be a list of Unicode objects.]{2.3}
|
||||||
|
|
||||||
\begin{funcdesc}{lstat}{path}
|
\begin{funcdesc}{lstat}{path}
|
||||||
Like \function{stat()}, but do not follow symbolic links.
|
Like \function{stat()}, but do not follow symbolic links.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{mkfifo}{path\optional{, mode}}
|
\begin{funcdesc}{mkfifo}{path\optional{, mode}}
|
||||||
Create a FIFO (a named pipe) named \var{path} with numeric mode
|
Create a FIFO (a named pipe) named \var{path} with numeric mode
|
||||||
\var{mode}. The default \var{mode} is \code{0666} (octal). The current
|
\var{mode}. The default \var{mode} is \code{0666} (octal). The current
|
||||||
umask value is first masked out from the mode.
|
umask value is first masked out from the mode.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
|
|
||||||
FIFOs are pipes that can be accessed like regular files. FIFOs exist
|
FIFOs are pipes that can be accessed like regular files. FIFOs exist
|
||||||
until they are deleted (for example with \function{os.unlink()}).
|
until they are deleted (for example with \function{os.unlink()}).
|
||||||
|
|
@ -844,7 +844,7 @@ known to the host operating system are given in the
|
||||||
\code{pathconf_names} dictionary. For configuration variables not
|
\code{pathconf_names} dictionary. For configuration variables not
|
||||||
included in that mapping, passing an integer for \var{name} is also
|
included in that mapping, passing an integer for \var{name} is also
|
||||||
accepted.
|
accepted.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
|
|
||||||
If \var{name} is a string and is not known, \exception{ValueError} is
|
If \var{name} is a string and is not known, \exception{ValueError} is
|
||||||
raised. If a specific value for \var{name} is not supported by the
|
raised. If a specific value for \var{name} is not supported by the
|
||||||
|
|
@ -858,7 +858,7 @@ Dictionary mapping names accepted by \function{pathconf()} and
|
||||||
\function{fpathconf()} to the integer values defined for those names
|
\function{fpathconf()} to the integer values defined for those names
|
||||||
by the host operating system. This can be used to determine the set
|
by the host operating system. This can be used to determine the set
|
||||||
of names known to the system.
|
of names known to the system.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{funcdesc}{readlink}{path}
|
\begin{funcdesc}{readlink}{path}
|
||||||
|
|
@ -866,7 +866,7 @@ Return a string representing the path to which the symbolic link
|
||||||
points. The result may be either an absolute or relative pathname; if
|
points. The result may be either an absolute or relative pathname; if
|
||||||
it is relative, it may be converted to an absolute pathname using
|
it is relative, it may be converted to an absolute pathname using
|
||||||
\code{os.path.join(os.path.dirname(\var{path}), \var{result})}.
|
\code{os.path.join(os.path.dirname(\var{path}), \var{result})}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{remove}{path}
|
\begin{funcdesc}{remove}{path}
|
||||||
|
|
@ -1079,7 +1079,7 @@ behavior of this function depends on the C library implementation;
|
||||||
some aspects are underspecified in system documentation.
|
some aspects are underspecified in system documentation.
|
||||||
\warning{Use of \function{tempnam()} is vulnerable to symlink attacks;
|
\warning{Use of \function{tempnam()} is vulnerable to symlink attacks;
|
||||||
consider using \function{tmpfile()} instead.}
|
consider using \function{tmpfile()} instead.}
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{tmpnam}{}
|
\begin{funcdesc}{tmpnam}{}
|
||||||
|
|
@ -1238,7 +1238,7 @@ Generate a \constant{SIGABRT} signal to the current process. On
|
||||||
process immediately returns an exit code of \code{3}. Be aware that
|
process immediately returns an exit code of \code{3}. Be aware that
|
||||||
programs which use \function{signal.signal()} to register a handler
|
programs which use \function{signal.signal()} to register a handler
|
||||||
for \constant{SIGABRT} will behave differently.
|
for \constant{SIGABRT} will behave differently.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{execl}{path, arg0, arg1, \moreargs}
|
\begin{funcdesc}{execl}{path, arg0, arg1, \moreargs}
|
||||||
|
|
@ -1284,13 +1284,13 @@ environment variables for the new process; the \function{execl()},
|
||||||
\function{execlp()}, \function{execv()}, and \function{execvp()}
|
\function{execlp()}, \function{execv()}, and \function{execvp()}
|
||||||
all cause the new process to inherit the environment of the current
|
all cause the new process to inherit the environment of the current
|
||||||
process.
|
process.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{_exit}{n}
|
\begin{funcdesc}{_exit}{n}
|
||||||
Exit to the system with status \var{n}, without calling cleanup
|
Exit to the system with status \var{n}, without calling cleanup
|
||||||
handlers, flushing stdio buffers, etc.
|
handlers, flushing stdio buffers, etc.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
|
|
||||||
\begin{notice}
|
\begin{notice}
|
||||||
The standard way to exit is \code{sys.exit(\var{n})}.
|
The standard way to exit is \code{sys.exit(\var{n})}.
|
||||||
|
|
@ -1306,76 +1306,76 @@ mail server's external command delivery program.
|
||||||
|
|
||||||
\begin{datadesc}{EX_OK}
|
\begin{datadesc}{EX_OK}
|
||||||
Exit code that means no error occurred.
|
Exit code that means no error occurred.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_USAGE}
|
\begin{datadesc}{EX_USAGE}
|
||||||
Exit code that means the command was used incorrectly, such as when
|
Exit code that means the command was used incorrectly, such as when
|
||||||
the wrong number of arguments are given.
|
the wrong number of arguments are given.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_DATAERR}
|
\begin{datadesc}{EX_DATAERR}
|
||||||
Exit code that means the input data was incorrect.
|
Exit code that means the input data was incorrect.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_NOINPUT}
|
\begin{datadesc}{EX_NOINPUT}
|
||||||
Exit code that means an input file did not exist or was not readable.
|
Exit code that means an input file did not exist or was not readable.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_NOUSER}
|
\begin{datadesc}{EX_NOUSER}
|
||||||
Exit code that means a specified user did not exist.
|
Exit code that means a specified user did not exist.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_NOHOST}
|
\begin{datadesc}{EX_NOHOST}
|
||||||
Exit code that means a specified host did not exist.
|
Exit code that means a specified host did not exist.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_UNAVAILABLE}
|
\begin{datadesc}{EX_UNAVAILABLE}
|
||||||
Exit code that means that a required service is unavailable.
|
Exit code that means that a required service is unavailable.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_SOFTWARE}
|
\begin{datadesc}{EX_SOFTWARE}
|
||||||
Exit code that means an internal software error was detected.
|
Exit code that means an internal software error was detected.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_OSERR}
|
\begin{datadesc}{EX_OSERR}
|
||||||
Exit code that means an operating system error was detected, such as
|
Exit code that means an operating system error was detected, such as
|
||||||
the inability to fork or create a pipe.
|
the inability to fork or create a pipe.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_OSFILE}
|
\begin{datadesc}{EX_OSFILE}
|
||||||
Exit code that means some system file did not exist, could not be
|
Exit code that means some system file did not exist, could not be
|
||||||
opened, or had some other kind of error.
|
opened, or had some other kind of error.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_CANTCREAT}
|
\begin{datadesc}{EX_CANTCREAT}
|
||||||
Exit code that means a user specified output file could not be created.
|
Exit code that means a user specified output file could not be created.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_IOERR}
|
\begin{datadesc}{EX_IOERR}
|
||||||
Exit code that means that an error occurred while doing I/O on some file.
|
Exit code that means that an error occurred while doing I/O on some file.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
@ -1383,40 +1383,40 @@ Availability: \UNIX.
|
||||||
Exit code that means a temporary failure occurred. This indicates
|
Exit code that means a temporary failure occurred. This indicates
|
||||||
something that may not really be an error, such as a network
|
something that may not really be an error, such as a network
|
||||||
connection that couldn't be made during a retryable operation.
|
connection that couldn't be made during a retryable operation.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_PROTOCOL}
|
\begin{datadesc}{EX_PROTOCOL}
|
||||||
Exit code that means that a protocol exchange was illegal, invalid, or
|
Exit code that means that a protocol exchange was illegal, invalid, or
|
||||||
not understood.
|
not understood.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_NOPERM}
|
\begin{datadesc}{EX_NOPERM}
|
||||||
Exit code that means that there were insufficient permissions to
|
Exit code that means that there were insufficient permissions to
|
||||||
perform the operation (but not intended for file system problems).
|
perform the operation (but not intended for file system problems).
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_CONFIG}
|
\begin{datadesc}{EX_CONFIG}
|
||||||
Exit code that means that some kind of configuration error occurred.
|
Exit code that means that some kind of configuration error occurred.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{EX_NOTFOUND}
|
\begin{datadesc}{EX_NOTFOUND}
|
||||||
Exit code that means something like ``an entry was not found''.
|
Exit code that means something like ``an entry was not found''.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{funcdesc}{fork}{}
|
\begin{funcdesc}{fork}{}
|
||||||
Fork a child process. Return \code{0} in the child, the child's
|
Fork a child process. Return \code{0} in the child, the child's
|
||||||
process id in the parent.
|
process id in the parent.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{forkpty}{}
|
\begin{funcdesc}{forkpty}{}
|
||||||
|
|
@ -1426,7 +1426,7 @@ where \var{pid} is \code{0} in the child, the new child's process id
|
||||||
in the parent, and \var{fd} is the file descriptor of the master end
|
in the parent, and \var{fd} is the file descriptor of the master end
|
||||||
of the pseudo-terminal. For a more portable approach, use the
|
of the pseudo-terminal. For a more portable approach, use the
|
||||||
\refmodule{pty} module.
|
\refmodule{pty} module.
|
||||||
Availability: Some flavors of \UNIX.
|
Availability: Macintosh, Some flavors of \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{kill}{pid, sig}
|
\begin{funcdesc}{kill}{pid, sig}
|
||||||
|
|
@ -1435,27 +1435,27 @@ Availability: Some flavors of \UNIX.
|
||||||
Kill the process \var{pid} with signal \var{sig}. Constants for the
|
Kill the process \var{pid} with signal \var{sig}. Constants for the
|
||||||
specific signals available on the host platform are defined in the
|
specific signals available on the host platform are defined in the
|
||||||
\refmodule{signal} module.
|
\refmodule{signal} module.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{killpg}{pgid, sig}
|
\begin{funcdesc}{killpg}{pgid, sig}
|
||||||
\index{process!killing}
|
\index{process!killing}
|
||||||
\index{process!signalling}
|
\index{process!signalling}
|
||||||
Kill the process group \var{pgid} with the signal \var{sig}.
|
Kill the process group \var{pgid} with the signal \var{sig}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{nice}{increment}
|
\begin{funcdesc}{nice}{increment}
|
||||||
Add \var{increment} to the process's ``niceness''. Return the new
|
Add \var{increment} to the process's ``niceness''. Return the new
|
||||||
niceness.
|
niceness.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{plock}{op}
|
\begin{funcdesc}{plock}{op}
|
||||||
Lock program segments into memory. The value of \var{op}
|
Lock program segments into memory. The value of \var{op}
|
||||||
(defined in \code{<sys/lock.h>}) determines which segments are locked.
|
(defined in \code{<sys/lock.h>}) determines which segments are locked.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdescni}{popen}{\unspecified}
|
\begin{funcdescni}{popen}{\unspecified}
|
||||||
|
|
@ -1536,7 +1536,7 @@ Possible values for the \var{mode} parameter to the \function{spawn*()}
|
||||||
family of functions. If either of these values is given, the
|
family of functions. If either of these values is given, the
|
||||||
\function{spawn*()} functions will return as soon as the new process
|
\function{spawn*()} functions will return as soon as the new process
|
||||||
has been created, with the process ID as the return value.
|
has been created, with the process ID as the return value.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\versionadded{1.6}
|
\versionadded{1.6}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
@ -1547,7 +1547,7 @@ family of functions. If this is given as \var{mode}, the
|
||||||
has run to completion and will return the exit code of the process the
|
has run to completion and will return the exit code of the process the
|
||||||
run is successful, or \code{-\var{signal}} if a signal kills the
|
run is successful, or \code{-\var{signal}} if a signal kills the
|
||||||
process.
|
process.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\versionadded{1.6}
|
\versionadded{1.6}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
@ -1601,7 +1601,7 @@ this is always \code{0}; on \program{cmd.exe} systems (Windows NT, 2000
|
||||||
and XP) this is the exit status of the command run; on systems using
|
and XP) this is the exit status of the command run; on systems using
|
||||||
a non-native shell, consult your shell documentation.
|
a non-native shell, consult your shell documentation.
|
||||||
|
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{times}{}
|
\begin{funcdesc}{times}{}
|
||||||
|
|
@ -1612,7 +1612,7 @@ user time, children's system time, and elapsed real time since a fixed
|
||||||
point in the past, in that order. See the \UNIX{} manual page
|
point in the past, in that order. See the \UNIX{} manual page
|
||||||
\manpage{times}{2} or the corresponding Windows Platform API
|
\manpage{times}{2} or the corresponding Windows Platform API
|
||||||
documentation.
|
documentation.
|
||||||
Availability: \UNIX, Windows.
|
Availability: Macintosh, \UNIX, Windows.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{wait}{}
|
\begin{funcdesc}{wait}{}
|
||||||
|
|
@ -1621,7 +1621,7 @@ its pid and exit status indication: a 16-bit number, whose low byte is
|
||||||
the signal number that killed the process, and whose high byte is the
|
the signal number that killed the process, and whose high byte is the
|
||||||
exit status (if the signal number is zero); the high bit of the low
|
exit status (if the signal number is zero); the high bit of the low
|
||||||
byte is set if a core file was produced.
|
byte is set if a core file was produced.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{waitpid}{pid, options}
|
\begin{funcdesc}{waitpid}{pid, options}
|
||||||
|
|
@ -1659,7 +1659,7 @@ return suitable process handles.
|
||||||
\begin{datadesc}{WNOHANG}
|
\begin{datadesc}{WNOHANG}
|
||||||
The option for \function{waitpid()} to avoid hanging if no child
|
The option for \function{waitpid()} to avoid hanging if no child
|
||||||
process status is available immediately.
|
process status is available immediately.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{WCONTINUED}
|
\begin{datadesc}{WCONTINUED}
|
||||||
|
|
@ -1674,7 +1674,7 @@ Availability: Some \UNIX{} systems.
|
||||||
This option causes child processes to be reported if they have been
|
This option causes child processes to be reported if they have been
|
||||||
stopped but their current state has not been reported since they were
|
stopped but their current state has not been reported since they were
|
||||||
stopped.
|
stopped.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
@ -1686,7 +1686,7 @@ process.
|
||||||
\begin{funcdesc}{WCOREDUMP}{status}
|
\begin{funcdesc}{WCOREDUMP}{status}
|
||||||
Returns \code{True} if a core dump was generated for the process,
|
Returns \code{True} if a core dump was generated for the process,
|
||||||
otherwise it returns \code{False}.
|
otherwise it returns \code{False}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\versionadded{2.3}
|
\versionadded{2.3}
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
@ -1706,30 +1706,30 @@ Availability: \UNIX.
|
||||||
\begin{funcdesc}{WIFSIGNALED}{status}
|
\begin{funcdesc}{WIFSIGNALED}{status}
|
||||||
Returns \code{True} if the process exited due to a signal, otherwise
|
Returns \code{True} if the process exited due to a signal, otherwise
|
||||||
it returns \code{False}.
|
it returns \code{False}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{WIFEXITED}{status}
|
\begin{funcdesc}{WIFEXITED}{status}
|
||||||
Returns \code{True} if the process exited using the \manpage{exit}{2}
|
Returns \code{True} if the process exited using the \manpage{exit}{2}
|
||||||
system call, otherwise it returns \code{False}.
|
system call, otherwise it returns \code{False}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{WEXITSTATUS}{status}
|
\begin{funcdesc}{WEXITSTATUS}{status}
|
||||||
If \code{WIFEXITED(\var{status})} is true, return the integer
|
If \code{WIFEXITED(\var{status})} is true, return the integer
|
||||||
parameter to the \manpage{exit}{2} system call. Otherwise, the return
|
parameter to the \manpage{exit}{2} system call. Otherwise, the return
|
||||||
value is meaningless.
|
value is meaningless.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{WSTOPSIG}{status}
|
\begin{funcdesc}{WSTOPSIG}{status}
|
||||||
Return the signal which caused the process to stop.
|
Return the signal which caused the process to stop.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{WTERMSIG}{status}
|
\begin{funcdesc}{WTERMSIG}{status}
|
||||||
Return the signal which caused the process to exit.
|
Return the signal which caused the process to exit.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1746,7 +1746,7 @@ known to the host operating system are given in the
|
||||||
\code{confstr_names} dictionary. For configuration variables not
|
\code{confstr_names} dictionary. For configuration variables not
|
||||||
included in that mapping, passing an integer for \var{name} is also
|
included in that mapping, passing an integer for \var{name} is also
|
||||||
accepted.
|
accepted.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
|
|
||||||
If the configuration value specified by \var{name} isn't defined, the
|
If the configuration value specified by \var{name} isn't defined, the
|
||||||
empty string is returned.
|
empty string is returned.
|
||||||
|
|
@ -1762,7 +1762,7 @@ error number.
|
||||||
Dictionary mapping names accepted by \function{confstr()} to the
|
Dictionary mapping names accepted by \function{confstr()} to the
|
||||||
integer values defined for those names by the host operating system.
|
integer values defined for those names by the host operating system.
|
||||||
This can be used to determine the set of names known to the system.
|
This can be used to determine the set of names known to the system.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{funcdesc}{getloadavg}{}
|
\begin{funcdesc}{getloadavg}{}
|
||||||
|
|
@ -1780,14 +1780,14 @@ If the configuration value specified by \var{name} isn't defined,
|
||||||
parameter for \function{confstr()} apply here as well; the dictionary
|
parameter for \function{confstr()} apply here as well; the dictionary
|
||||||
that provides information on the known names is given by
|
that provides information on the known names is given by
|
||||||
\code{sysconf_names}.
|
\code{sysconf_names}.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{datadesc}{sysconf_names}
|
\begin{datadesc}{sysconf_names}
|
||||||
Dictionary mapping names accepted by \function{sysconf()} to the
|
Dictionary mapping names accepted by \function{sysconf()} to the
|
||||||
integer values defined for those names by the host operating system.
|
integer values defined for those names by the host operating system.
|
||||||
This can be used to determine the set of names known to the system.
|
This can be used to determine the set of names known to the system.
|
||||||
Availability: \UNIX.
|
Availability: Macintosh, \UNIX.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1801,21 +1801,21 @@ Higher-level operations on pathnames are defined in the
|
||||||
\begin{datadesc}{curdir}
|
\begin{datadesc}{curdir}
|
||||||
The constant string used by the operating system to refer to the current
|
The constant string used by the operating system to refer to the current
|
||||||
directory.
|
directory.
|
||||||
For example: \code{'.'} for \POSIX{} or \code{':'} for the Macintosh.
|
For example: \code{'.'} for \POSIX{} or \code{':'} for Mac OS 9.
|
||||||
Also available via \module{os.path}.
|
Also available via \module{os.path}.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{pardir}
|
\begin{datadesc}{pardir}
|
||||||
The constant string used by the operating system to refer to the parent
|
The constant string used by the operating system to refer to the parent
|
||||||
directory.
|
directory.
|
||||||
For example: \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh.
|
For example: \code{'..'} for \POSIX{} or \code{'::'} for Mac OS 9.
|
||||||
Also available via \module{os.path}.
|
Also available via \module{os.path}.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{sep}
|
\begin{datadesc}{sep}
|
||||||
The character used by the operating system to separate pathname components,
|
The character used by the operating system to separate pathname components,
|
||||||
for example, \character{/} for \POSIX{} or \character{:} for the
|
for example, \character{/} for \POSIX{} or \character{:} for
|
||||||
Macintosh. Note that knowing this is not sufficient to be able to
|
Mac OS 9. Note that knowing this is not sufficient to be able to
|
||||||
parse or concatenate pathnames --- use \function{os.path.split()} and
|
parse or concatenate pathnames --- use \function{os.path.split()} and
|
||||||
\function{os.path.join()} --- but it is occasionally useful.
|
\function{os.path.join()} --- but it is occasionally useful.
|
||||||
Also available via \module{os.path}.
|
Also available via \module{os.path}.
|
||||||
|
|
@ -1859,8 +1859,8 @@ for example, \code{'\e r\e n'} for Windows.
|
||||||
|
|
||||||
\begin{datadesc}{devnull}
|
\begin{datadesc}{devnull}
|
||||||
The file path of the null device.
|
The file path of the null device.
|
||||||
For example: \code{'/dev/null'} for \POSIX{} or \code{'Dev:Nul'} for the
|
For example: \code{'/dev/null'} for \POSIX{} or \code{'Dev:Nul'} for
|
||||||
Macintosh.
|
Mac OS 9.
|
||||||
Also available via \module{os.path}.
|
Also available via \module{os.path}.
|
||||||
\versionadded{2.4}
|
\versionadded{2.4}
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ search path.
|
||||||
It starts by constructing up to four directories from a head and a
|
It starts by constructing up to four directories from a head and a
|
||||||
tail part. For the head part, it uses \code{sys.prefix} and
|
tail part. For the head part, it uses \code{sys.prefix} and
|
||||||
\code{sys.exec_prefix}; empty heads are skipped. For
|
\code{sys.exec_prefix}; empty heads are skipped. For
|
||||||
the tail part, it uses the empty string (on Macintosh or Windows) or
|
the tail part, it uses the empty string (on Windows) or
|
||||||
it uses first \file{lib/python\shortversion/site-packages} and then
|
it uses first \file{lib/python\shortversion/site-packages} and then
|
||||||
\file{lib/site-python} (on \UNIX). For each of the distinct
|
\file{lib/site-python} (on \UNIX and Macintosh). For each of the distinct
|
||||||
head-tail combinations, it sees if it refers to an existing directory,
|
head-tail combinations, it sees if it refers to an existing directory,
|
||||||
and if so, adds it to \code{sys.path} and also inspects the newly added
|
and if so, adds it to \code{sys.path} and also inspects the newly added
|
||||||
path for configuration files.
|
path for configuration files.
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,6 @@ files in. The list is:
|
||||||
\item The directory named by the \envvar{TMP} environment variable.
|
\item The directory named by the \envvar{TMP} environment variable.
|
||||||
\item A platform-specific location:
|
\item A platform-specific location:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item On Macintosh, the \file{Temporary Items} folder.
|
|
||||||
\item On RiscOS, the directory named by the
|
\item On RiscOS, the directory named by the
|
||||||
\envvar{Wimp\$ScrapDir} environment variable.
|
\envvar{Wimp\$ScrapDir} environment variable.
|
||||||
\item On Windows, the directories
|
\item On Windows, the directories
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ different levels, i.e. to handle clicks in a single dialog window in a
|
||||||
non-standard way it is not necessary to override the complete event
|
non-standard way it is not necessary to override the complete event
|
||||||
handling.
|
handling.
|
||||||
|
|
||||||
The \module{FrameWork} is still very much work-in-progress, and the
|
Work on the \module{FrameWork} has pretty much stopped, now that
|
||||||
|
\module{PyObjC} is available for full Cocoa access from Python, and the
|
||||||
documentation describes only the most important functionality, and not
|
documentation describes only the most important functionality, and not
|
||||||
in the most logical manner at that. Examine the source or the examples
|
in the most logical manner at that. Examine the source or the examples
|
||||||
for more details. The following are some comments posted on the
|
for more details. The following are some comments posted on the
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,3 @@
|
||||||
\section{\module{mac} ---
|
|
||||||
Implementations for the \module{os} module}
|
|
||||||
|
|
||||||
\declaremodule{builtin}{mac}
|
|
||||||
\platform{Mac}
|
|
||||||
\modulesynopsis{Implementations for the \module{os} module.}
|
|
||||||
|
|
||||||
|
|
||||||
This module implements the Mac OS 9 operating system dependent functionality
|
|
||||||
provided by the standard module \module{os}\refstmodindex{os}. It is
|
|
||||||
best accessed through the \module{os} module. This module is only available in
|
|
||||||
MacPython-OS9, on MacPython-OSX \module{posix} is used.
|
|
||||||
|
|
||||||
The following functions are available in this module:
|
|
||||||
\function{chdir()},
|
|
||||||
\function{close()},
|
|
||||||
\function{dup()},
|
|
||||||
\function{fdopen()},
|
|
||||||
\function{getcwd()},
|
|
||||||
\function{lseek()},
|
|
||||||
\function{listdir()},
|
|
||||||
\function{mkdir()},
|
|
||||||
\function{open()},
|
|
||||||
\function{read()},
|
|
||||||
\function{rename()},
|
|
||||||
\function{rmdir()},
|
|
||||||
\function{stat()},
|
|
||||||
\function{sync()},
|
|
||||||
\function{unlink()},
|
|
||||||
\function{write()},
|
|
||||||
as well as the exception \exception{error}. Note that the times
|
|
||||||
returned by \function{stat()} are floating-point values, like all time
|
|
||||||
values in MacPython-OS9.
|
|
||||||
|
|
||||||
\section{\module{macpath} ---
|
\section{\module{macpath} ---
|
||||||
MacOS path manipulation functions}
|
MacOS path manipulation functions}
|
||||||
|
|
@ -41,9 +8,10 @@ values in MacPython-OS9.
|
||||||
\modulesynopsis{MacOS path manipulation functions.}
|
\modulesynopsis{MacOS path manipulation functions.}
|
||||||
|
|
||||||
|
|
||||||
This module is the Macintosh implementation of the \module{os.path}
|
This module is the Mac OS 9 (and earlier) implementation of the \module{os.path}
|
||||||
module. It is most portably accessed as
|
module. It can be used to manipulate old-style Macintosh pathnames on Mac OS
|
||||||
\module{os.path}\refstmodindex{os.path}. Refer to the
|
X (or any other platform).
|
||||||
|
Refer to the
|
||||||
\citetitle[../lib/lib.html]{Python Library Reference} for
|
\citetitle[../lib/lib.html]{Python Library Reference} for
|
||||||
documentation of \module{os.path}.
|
documentation of \module{os.path}.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,8 @@
|
||||||
\modulesynopsis{Access to Internet Config.}
|
\modulesynopsis{Access to Internet Config.}
|
||||||
|
|
||||||
|
|
||||||
This module provides access to Macintosh Internet
|
This module provides access to various internet-related preferences
|
||||||
Config\index{Internet Config} package,
|
set through \program{System Preferences} or the \program{Finder}.
|
||||||
which stores preferences for Internet programs such as mail address,
|
|
||||||
default homepage, etc. Also, Internet Config contains an elaborate set
|
|
||||||
of mappings from Macintosh creator/type codes to foreign filename
|
|
||||||
extensions plus information on how to transfer files (binary, ascii,
|
|
||||||
etc.). Since MacOS 9, this module is a control panel named Internet.
|
|
||||||
|
|
||||||
There is a low-level companion module
|
There is a low-level companion module
|
||||||
\module{icglue}\refbimodindex{icglue} which provides the basic
|
\module{icglue}\refbimodindex{icglue} which provides the basic
|
||||||
|
|
@ -92,7 +87,7 @@ complete incomplete URLs.
|
||||||
|
|
||||||
\begin{methoddesc}{mapfile}{file}
|
\begin{methoddesc}{mapfile}{file}
|
||||||
Return the mapping entry for the given \var{file}, which can be passed
|
Return the mapping entry for the given \var{file}, which can be passed
|
||||||
as either a filename or an \function{macfs.FSSpec()} result, and which
|
as either a filename or an \function{FSSpec()} result, and which
|
||||||
need not exist.
|
need not exist.
|
||||||
|
|
||||||
The mapping entry is returned as a tuple \code{(\var{version},
|
The mapping entry is returned as a tuple \code{(\var{version},
|
||||||
|
|
@ -122,7 +117,7 @@ The mapping entry is returned in the same format as for \var{mapfile}.
|
||||||
|
|
||||||
\begin{methoddesc}{settypecreator}{file}
|
\begin{methoddesc}{settypecreator}{file}
|
||||||
Given an existing \var{file}, specified either as a filename or as an
|
Given an existing \var{file}, specified either as a filename or as an
|
||||||
\function{macfs.FSSpec()} result, set its creator and type correctly based
|
\function{FSSpec()} result, set its creator and type correctly based
|
||||||
on its extension. The finder is told about the change, so the finder
|
on its extension. The finder is told about the change, so the finder
|
||||||
icon will be updated quickly.
|
icon will be updated quickly.
|
||||||
\end{methoddesc}
|
\end{methoddesc}
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,10 @@ Note the capitalization of the module name; this is a historical
|
||||||
artifact.
|
artifact.
|
||||||
|
|
||||||
\begin{datadesc}{runtimemodel}
|
\begin{datadesc}{runtimemodel}
|
||||||
Either\code{'carbon'} or \code{'macho'}. This
|
Always \code{'macho'}, from Python 2.4 on.
|
||||||
signifies whether this Python uses the Mac OS X and Mac OS 9 compatible
|
In earlier versions of Python the value could
|
||||||
CarbonLib style or the Mac OS
|
also be \code{'ppc'} for the classic Mac OS 8 runtime model or
|
||||||
X-only Mach-O style. In earlier versions of Python the value could
|
\code{'carbon'} for the Mac OS 9 runtime model.
|
||||||
also be \code{'ppc'} for the classic Mac OS 8 runtime model.
|
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{datadesc}{linkmodel}
|
\begin{datadesc}{linkmodel}
|
||||||
|
|
@ -26,8 +25,9 @@ The way the interpreter has been linked. As extension modules may be
|
||||||
incompatible between linking models, packages could use this information to give
|
incompatible between linking models, packages could use this information to give
|
||||||
more decent error messages. The value is one of \code{'static'} for a
|
more decent error messages. The value is one of \code{'static'} for a
|
||||||
statically linked Python, \code{'framework'} for Python in a Mac OS X framework,
|
statically linked Python, \code{'framework'} for Python in a Mac OS X framework,
|
||||||
\code{'shared'} for Python in a standard unix shared library and
|
\code{'shared'} for Python in a standard unix shared library.
|
||||||
\code{'cfm'} for the Mac OS 9-compatible Python.
|
Older Pythons could also have the value
|
||||||
|
\code{'cfm'} for Mac OS 9-compatible Python.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{excdesc}{Error}
|
\begin{excdesc}{Error}
|
||||||
|
|
@ -39,84 +39,16 @@ Symbolic names for all known error codes are defined in the standard
|
||||||
module \refmodule{macerrors}.\refstmodindex{macerrors}
|
module \refmodule{macerrors}.\refstmodindex{macerrors}
|
||||||
\end{excdesc}
|
\end{excdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{SetEventHandler}{handler}
|
|
||||||
In the inner interpreter loop Python will occasionally check for events,
|
|
||||||
unless disabled with \function{ScheduleParams()}. With this function you
|
|
||||||
can pass a Python event-handler function that will be called if an event
|
|
||||||
is available. The event is passed as parameter and the function should return
|
|
||||||
non-zero if the event has been fully processed, otherwise event processing
|
|
||||||
continues (by passing the event to the console window package, for instance).
|
|
||||||
|
|
||||||
Call \function{SetEventHandler()} without a parameter to clear the
|
|
||||||
event handler. Setting an event handler while one is already set is an
|
|
||||||
error.
|
|
||||||
|
|
||||||
Availability: MacPython-OS9.
|
|
||||||
\end{funcdesc}
|
|
||||||
|
|
||||||
\begin{funcdesc}{SchedParams}{\optional{doint\optional{, evtmask\optional{,
|
|
||||||
besocial\optional{, interval\optional{,
|
|
||||||
bgyield}}}}}}
|
|
||||||
Influence the interpreter inner loop event handling. \var{Interval}
|
|
||||||
specifies how often (in seconds, floating point) the interpreter
|
|
||||||
should enter the event processing code. When true, \var{doint} causes
|
|
||||||
interrupt (command-dot) checking to be done. \var{evtmask} tells the
|
|
||||||
interpreter to do event processing for events in the mask (redraws,
|
|
||||||
mouseclicks to switch to other applications, etc). The \var{besocial}
|
|
||||||
flag gives other processes a chance to run. They are granted minimal
|
|
||||||
runtime when Python is in the foreground and \var{bgyield} seconds per
|
|
||||||
\var{interval} when Python runs in the background.
|
|
||||||
|
|
||||||
All parameters are optional, and default to the current value. The return
|
|
||||||
value of this function is a tuple with the old values of these options.
|
|
||||||
Initial defaults are that all processing is enabled, checking is done every
|
|
||||||
quarter second and the processor is given up for a quarter second when in the
|
|
||||||
background.
|
|
||||||
|
|
||||||
The most common use case is to call \code{SchedParams(0, 0)} to completely disable
|
|
||||||
event handling in the interpreter mainloop.
|
|
||||||
|
|
||||||
Availability: MacPython-OS9.
|
|
||||||
\end{funcdesc}
|
|
||||||
|
|
||||||
\begin{funcdesc}{HandleEvent}{ev}
|
|
||||||
Pass the event record \var{ev} back to the Python event loop, or
|
|
||||||
possibly to the handler for the \code{sys.stdout} window (based on the
|
|
||||||
compiler used to build Python). This allows Python programs that do
|
|
||||||
their own event handling to still have some command-period and
|
|
||||||
window-switching capability.
|
|
||||||
|
|
||||||
If you attempt to call this function from an event handler set through
|
|
||||||
\function{SetEventHandler()} you will get an exception.
|
|
||||||
|
|
||||||
Availability: MacPython-OS9.
|
|
||||||
\end{funcdesc}
|
|
||||||
|
|
||||||
\begin{funcdesc}{GetErrorString}{errno}
|
\begin{funcdesc}{GetErrorString}{errno}
|
||||||
Return the textual description of MacOS error code \var{errno}.
|
Return the textual description of MacOS error code \var{errno}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{splash}{resid}
|
|
||||||
This function will put a splash window
|
|
||||||
on-screen, with the contents of the DLOG resource specified by
|
|
||||||
\var{resid}. Calling with a zero argument will remove the splash
|
|
||||||
screen. This function is useful if you want an applet to post a splash screen
|
|
||||||
early in initialization without first having to load numerous
|
|
||||||
extension modules.
|
|
||||||
|
|
||||||
Availability: MacPython-OS9.
|
|
||||||
\end{funcdesc}
|
|
||||||
|
|
||||||
\begin{funcdesc}{DebugStr}{message \optional{, object}}
|
\begin{funcdesc}{DebugStr}{message \optional{, object}}
|
||||||
On Mac OS 9, drop to the low-level debugger with message \var{message}. The
|
On Mac OS X the string is simply printed to stderr (on older
|
||||||
optional \var{object} argument is not used, but can easily be
|
Mac OS systems more elaborate functionality was available),
|
||||||
inspected from the debugger. On Mac OS X the string is simply printed
|
but it provides a convenient location to attach a breakpoint
|
||||||
to stderr.
|
in a low-level debugger like \program{gdb}.
|
||||||
|
|
||||||
Note that you should use this function with extreme care: if no
|
|
||||||
low-level debugger like MacsBug is installed this call will crash your
|
|
||||||
system. It is intended mainly for developers of Python extension
|
|
||||||
modules.
|
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{SysBeep}{}
|
\begin{funcdesc}{SysBeep}{}
|
||||||
|
|
@ -155,6 +87,4 @@ or when the current interpreter is not running from a fullblown application
|
||||||
bundle. A script runs from an application bundle either when it has been
|
bundle. A script runs from an application bundle either when it has been
|
||||||
started with \program{pythonw} instead of \program{python} or when running
|
started with \program{pythonw} instead of \program{python} or when running
|
||||||
as an applet.
|
as an applet.
|
||||||
|
|
||||||
On Mac OS 9 the method always returns \code{True}.
|
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
\chapter{MacPython OSA Modules \label{scripting}}
|
\chapter{MacPython OSA Modules \label{scripting}}
|
||||||
|
|
||||||
Python has a fairly complete implementation of the Open Scripting
|
This chapter describes the current implementation of the Open Scripting
|
||||||
Architecture (OSA, also commonly referred to as AppleScript), allowing
|
Architecure (OSA, also commonly referred to as AppleScript) for Python, allowing
|
||||||
you to control scriptable applications from your Python program,
|
you to control scriptable applications from your Python program,
|
||||||
and with a fairly pythonic interface.
|
and with a fairly pythonic interface. Development on this set of modules
|
||||||
|
has stopped, and a replacement is expected for Python 2.5.
|
||||||
|
|
||||||
For a description of the various components of AppleScript and OSA, and
|
For a description of the various components of AppleScript and OSA, and
|
||||||
to get an understanding of the architecture and terminology, you should
|
to get an understanding of the architecture and terminology, you should
|
||||||
|
|
|
||||||
|
|
@ -21,17 +21,7 @@ touch with
|
||||||
\modulesynopsis{Helper module for BuildApplet, BuildApplication and
|
\modulesynopsis{Helper module for BuildApplet, BuildApplication and
|
||||||
macfreeze.}
|
macfreeze.}
|
||||||
|
|
||||||
|
\deprecated{2.4}
|
||||||
\section{\module{py_resource} --- Resources from Python code}
|
|
||||||
\declaremodule[pyresource]{standard}{py_resource}
|
|
||||||
\platform{Mac}
|
|
||||||
\modulesynopsis{Helper to create \texttt{'PYC~'} resources for compiled
|
|
||||||
applications.}
|
|
||||||
|
|
||||||
This module is primarily used as a help module for
|
|
||||||
\program{BuildApplet} and \program{BuildApplication}. It is able to
|
|
||||||
store compiled Python code as \texttt{'PYC~'} resources in a file.
|
|
||||||
|
|
||||||
|
|
||||||
\section{\module{cfmfile} --- Code Fragment Resource module}
|
\section{\module{cfmfile} --- Code Fragment Resource module}
|
||||||
\declaremodule{standard}{cfmfile}
|
\declaremodule{standard}{cfmfile}
|
||||||
|
|
@ -43,6 +33,7 @@ accompanying ``cfrg'' resources. It can parse them and merge them, and is
|
||||||
used by BuildApplication to combine all plugin modules to a single
|
used by BuildApplication to combine all plugin modules to a single
|
||||||
executable.
|
executable.
|
||||||
|
|
||||||
|
\deprecated{2.4}
|
||||||
|
|
||||||
\section{\module{icopen} --- Internet Config replacement for \method{open()}}
|
\section{\module{icopen} --- Internet Config replacement for \method{open()}}
|
||||||
\declaremodule{standard}{icopen}
|
\declaremodule{standard}{icopen}
|
||||||
|
|
@ -79,30 +70,6 @@ script is run under MacPython, as a MacPython applet or under OSX Python.
|
||||||
|
|
||||||
A low-level interface to Navigation Services.
|
A low-level interface to Navigation Services.
|
||||||
|
|
||||||
\section{\module{mkcwproject} --- Create CodeWarrior projects}
|
|
||||||
\declaremodule{standard}{mkcwproject}
|
|
||||||
\platform{Mac}
|
|
||||||
\modulesynopsis{Create CodeWarrior projects.}
|
|
||||||
|
|
||||||
\refmodindex{distutils}
|
|
||||||
\module{mkcwproject} creates project files for the Metrowerks CodeWarrior
|
|
||||||
development environment. It is a helper module for
|
|
||||||
\module{distutils} but can be used separately for more
|
|
||||||
control.
|
|
||||||
|
|
||||||
|
|
||||||
\section{\module{nsremote} --- Wrapper around Netscape OSA modules}
|
|
||||||
\declaremodule{standard}{nsremote}
|
|
||||||
\platform{Mac}
|
|
||||||
\modulesynopsis{Wrapper around Netscape OSA modules.}
|
|
||||||
|
|
||||||
\module{nsremote} is a wrapper around the Netscape OSA modules that
|
|
||||||
allows you to easily send your browser to a given URL. A related
|
|
||||||
module that may be of interest is the \module{webbrowser} module,
|
|
||||||
documented in the \citetitle[../lib/lib.html]{Python Library
|
|
||||||
Reference}.
|
|
||||||
|
|
||||||
|
|
||||||
\section{\module{PixMapWrapper} --- Wrapper for PixMap objects}
|
\section{\module{PixMapWrapper} --- Wrapper for PixMap objects}
|
||||||
\declaremodule{standard}{PixMapWrapper}
|
\declaremodule{standard}{PixMapWrapper}
|
||||||
\platform{Mac}
|
\platform{Mac}
|
||||||
|
|
@ -112,43 +79,6 @@ Reference}.
|
||||||
allows access to the fields by name. It also has methods to convert
|
allows access to the fields by name. It also has methods to convert
|
||||||
to and from \module{PIL} images.
|
to and from \module{PIL} images.
|
||||||
|
|
||||||
|
|
||||||
\section{\module{preferences} --- Application preferences manager}
|
|
||||||
\declaremodule{standard}{preferences}
|
|
||||||
\platform{Mac}
|
|
||||||
\modulesynopsis{Nice application preferences manager with support for
|
|
||||||
defaults.}
|
|
||||||
|
|
||||||
The \module{preferences} module allows storage of user preferences in
|
|
||||||
the system-wide preferences folder, with defaults coming from the
|
|
||||||
application itself and the possibility to override preferences for
|
|
||||||
specific situations.
|
|
||||||
|
|
||||||
|
|
||||||
\section{\module{pythonprefs} --- Preferences manager for Python}
|
|
||||||
\declaremodule{standard}{pythonprefs}
|
|
||||||
\platform{Mac}
|
|
||||||
\modulesynopsis{Specialized preferences manager for the Python
|
|
||||||
interpreter.}
|
|
||||||
|
|
||||||
This module is a specialization of the \refmodule{preferences} module
|
|
||||||
that allows reading and writing of the preferences for the Python
|
|
||||||
interpreter.
|
|
||||||
|
|
||||||
|
|
||||||
\section{\module{quietconsole} --- Non-visible standard output}
|
|
||||||
\declaremodule{standard}{quietconsole}
|
|
||||||
\platform{Mac}
|
|
||||||
\modulesynopsis{Buffered, non-visible standard output.}
|
|
||||||
|
|
||||||
\module{quietconsole} allows you to keep stdio output in a buffer
|
|
||||||
without displaying it (or without displaying the stdout window
|
|
||||||
altogether, if set with \program{EditPythonPrefs}) until you try to read from
|
|
||||||
stdin or disable the buffering, at which point all the saved output is
|
|
||||||
sent to the window. Good for programs with graphical user interfaces
|
|
||||||
that do want to display their output at a crash.
|
|
||||||
|
|
||||||
|
|
||||||
\section{\module{videoreader} --- Read QuickTime movies}
|
\section{\module{videoreader} --- Read QuickTime movies}
|
||||||
\declaremodule{standard}{videoreader}
|
\declaremodule{standard}{videoreader}
|
||||||
\platform{Mac}
|
\platform{Mac}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,25 @@
|
||||||
\chapter{Using Python on a Mac OS 9 Macintosh \label{using}}
|
\chapter{Using Python on a Macintosh \label{using}}
|
||||||
\sectionauthor{Bob Savage}{bobsavage@mac.com}
|
\sectionauthor{Bob Savage}{bobsavage@mac.com}
|
||||||
|
|
||||||
Using Python on a Macintosh, especially on Mac OS 9 (MacPython-OSX
|
Python on a Macintosh running Mac OS X is in principle very similar to
|
||||||
includes a complete \UNIX{} Python) can seem like something completely
|
Python on any other \UNIX platform, but there are a number of additional
|
||||||
different than using it on a \UNIX-like or Windows system. Most of the
|
features such as the IDE and the Package Manager that are worth pointing out.
|
||||||
Python documentation, both the ``official'' documentation and published
|
|
||||||
books, describe only how Python is used on these systems, causing
|
|
||||||
confusion for the new user of MacPython-OS9. This chapter gives a brief
|
|
||||||
introduction to the specifics of using Python on a Macintosh.
|
|
||||||
|
|
||||||
|
Python on Mac OS 9 or earlier can be quite different from Python on
|
||||||
|
Unix or Windows, but is beyond the scope of this manual, as that platform
|
||||||
|
is no longer supported, starting with Python 2.4. See
|
||||||
|
\url{http://www.cwi.nl/\textasciitilde jack/macpython} for installers
|
||||||
|
for the latest 2.3 release for Mac OS 9 and related documentation.
|
||||||
|
|
||||||
The section on the IDE (see Section \ref{IDE}) is relevant to MacPython-OSX
|
\section{Getting and Installing MacPython \label{getting-OSX}}
|
||||||
too.
|
|
||||||
|
|
||||||
\section{Getting and Installing MacPython-OSX \label{getting-OSX}}
|
Mac OS X 10.3 comes with Python 2.3 pre-installed by Apple.
|
||||||
|
This installation does not come with the IDE and other additions, however,
|
||||||
As of Python 2.3a2 the only sure way of getting MacPython-OSX on your machine
|
so to get these you need to install the \program{MacPython for Panther additions}
|
||||||
is getting a source distribution and building what is called a "framework Python".
|
from the MacPython website, \url{http://www.cwi.nl/\textasciitilde jack/macpython}.
|
||||||
The details are in the file \file{Mac/OSX/README}.
|
|
||||||
|
|
||||||
As binary installers become available the details will be posted to
|
|
||||||
\url{http://www.cwi.nl/\textasciitilde jack/macpython.html}.
|
|
||||||
|
|
||||||
|
For MacPython 2.4, or for any MacPython on earlier releases of Mac OS X,
|
||||||
|
you need to install a full distribution from the same website.
|
||||||
|
|
||||||
What you get after installing is a number of things:
|
What you get after installing is a number of things:
|
||||||
|
|
||||||
|
|
@ -41,6 +39,14 @@ What you get after installing is a number of things:
|
||||||
|
|
||||||
To uninstall MacPython you can simply remove these three things.
|
To uninstall MacPython you can simply remove these three things.
|
||||||
|
|
||||||
|
If you use the ``additions'' installer to install on top of an existing
|
||||||
|
Apple-Python you will not get the framework and the commandline interpreter,
|
||||||
|
as they have been installed by Apple already, in
|
||||||
|
\file{/System/Library/Frameworks/Python.framework} and
|
||||||
|
\file{/usr/bin/python}, respectively. You should in principle never modify
|
||||||
|
or delete these, as they are Apple-controlled and may be used by Apple- or
|
||||||
|
third-party software.
|
||||||
|
|
||||||
PythonIDE contains an Apple Help Viewer book called "MacPython Help"
|
PythonIDE contains an Apple Help Viewer book called "MacPython Help"
|
||||||
which you can access through its help menu. If you are completely new to
|
which you can access through its help menu. If you are completely new to
|
||||||
Python you should start reading the IDE introduction in that document.
|
Python you should start reading the IDE introduction in that document.
|
||||||
|
|
@ -57,18 +63,15 @@ menu when the IDE is running.
|
||||||
If you want to run Python scripts from the Terminal window command line
|
If you want to run Python scripts from the Terminal window command line
|
||||||
or from the Finder you first need an editor to create your script.
|
or from the Finder you first need an editor to create your script.
|
||||||
Mac OS X comes with a number of standard \UNIX{} command line editors,
|
Mac OS X comes with a number of standard \UNIX{} command line editors,
|
||||||
\program{vi} and \program{emacs} among them. If you want a more Mac-like
|
\program{vim} and \program{emacs} among them. If you want a more Mac-like
|
||||||
editor \program{BBEdit} or \program{TextWrangler} from Bare Bones Software
|
editor \program{BBEdit} or \program{TextWrangler} from Bare Bones Software
|
||||||
(see \url{http://www.barebones.com/products/bbedit/index.shtml}) are
|
(see \url{http://www.barebones.com/products/bbedit/index.shtml}) are
|
||||||
good choices. Their freeware \program{BBEdit Lite} is officially
|
good choices. \program{AppleWorks} or any other
|
||||||
discontinued but still available. \program{AppleWorks} or any other
|
|
||||||
word processor that can save files in ASCII is also a possibility, including
|
word processor that can save files in ASCII is also a possibility, including
|
||||||
\program{TextEdit} which is included with OS X.
|
\program{TextEdit} which is included with OS X.
|
||||||
|
|
||||||
To run your script from the Terminal window you must make sure that
|
To run your script from the Terminal window you must make sure that
|
||||||
\file{/usr/local/bin} is in your shell search path before \file{/usr/bin},
|
\file{/usr/local/bin} is in your shell search path.
|
||||||
where the Apple-supplied Python lives (which is version 2.2, as of Mac OS X
|
|
||||||
10.2.4).
|
|
||||||
|
|
||||||
To run your script from the Finder you have two options:
|
To run your script from the Finder you have two options:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
|
|
@ -101,263 +104,6 @@ See Apple's Technical Document QA1067 for details.
|
||||||
Installing additional Python packages is most easily done through the
|
Installing additional Python packages is most easily done through the
|
||||||
Package Manager, see the MacPython Help Book for details.
|
Package Manager, see the MacPython Help Book for details.
|
||||||
|
|
||||||
\section{Getting and Installing MacPython-OS9 \label{getting}}
|
|
||||||
|
|
||||||
The most recent release version as well as possible newer experimental
|
|
||||||
versions are best found at the MacPython page maintained by Jack
|
|
||||||
Jansen: \url{http://homepages.cwi.nl/\textasciitilde jack/macpython.html}.
|
|
||||||
|
|
||||||
Please refer to the \file{README} included with your distribution for
|
|
||||||
the most up-to-date instructions.
|
|
||||||
|
|
||||||
Note that MacPython-OS9 runs fine on Mac OS X, and it runs in native
|
|
||||||
mode, not in the Classic environment. Unless you have specific
|
|
||||||
requirements for a CFM-based Python there is no reason not to
|
|
||||||
use MacPython-OSX, though.
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{Entering the interactive Interpreter
|
|
||||||
\label{interpreter}}
|
|
||||||
|
|
||||||
The interactive interpreter that you will see used in Python
|
|
||||||
documentation is started by double-clicking the
|
|
||||||
\program{PythonInterpreter} icon, which looks like a 16-ton weight
|
|
||||||
falling. You should see the version information and the
|
|
||||||
\samp{>\code{>}>~} prompt. Use it exactly as described in the
|
|
||||||
standard documentation.
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{How to run a Python script}
|
|
||||||
|
|
||||||
There are several ways to run an existing Python script; two common
|
|
||||||
ways to run a Python script are ``drag and drop'' and ``double
|
|
||||||
clicking''. Other ways include running it from within the IDE (see
|
|
||||||
Section \ref{IDE}), or launching via AppleScript.
|
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{Drag and drop}
|
|
||||||
|
|
||||||
One of the easiest ways to launch a Python script is via ``Drag and
|
|
||||||
Drop''. This is just like launching a text file in the Finder by
|
|
||||||
``dragging'' it over your word processor's icon and ``dropping'' it
|
|
||||||
there. Make sure that you use an icon referring to the
|
|
||||||
\program{PythonInterpreter}, not the \program{IDE} or \program{Idle}
|
|
||||||
icons which have different behaviour which is described below.
|
|
||||||
|
|
||||||
Some things that might have gone wrong:
|
|
||||||
|
|
||||||
\begin{itemize}
|
|
||||||
\item
|
|
||||||
A window flashes after dropping the script onto the
|
|
||||||
\program{PythonInterpreter}, but then disappears. Most likely this is a
|
|
||||||
configuration issue; your \program{PythonInterpreter} is setup to exit
|
|
||||||
immediately upon completion, but your script assumes that if it prints
|
|
||||||
something that text will stick around for a while. To fix this, see
|
|
||||||
section \ref{defaults}.
|
|
||||||
|
|
||||||
\item
|
|
||||||
When you waved the script icon over the \program{PythonInterpreter},
|
|
||||||
the \program{PythonInterpreter} icon did not highlight. Most likely
|
|
||||||
the Creator code and document type is unset (or set incorrectly) --
|
|
||||||
this often happens when a file originates on a non-Mac computer. See
|
|
||||||
section \ref{creator-code} for more details.
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{Set Creator and Double Click \label{creator-code}}
|
|
||||||
|
|
||||||
If the script that you want to launch has the appropriate Creator Code
|
|
||||||
and File Type you can simply double-click on the script to launch it.
|
|
||||||
To be ``double-clickable'' a file needs to be of type \samp{TEXT},
|
|
||||||
with a creator code of \samp{Pyth}.
|
|
||||||
|
|
||||||
Setting the creator code and filetype can be done with the IDE (see
|
|
||||||
sections \ref{IDEwrite} and \ref{IDEapplet}), with an editor with a
|
|
||||||
Python mode (\program{BBEdit}) -- see section
|
|
||||||
\ref{scripting-with-BBedit}, or with assorted other Mac utilities, but
|
|
||||||
a script (\file{fixfiletypes.py}) has been included in the MacPython
|
|
||||||
distribution, making it possible to set the proper Type and Creator
|
|
||||||
Codes with Python.
|
|
||||||
|
|
||||||
The \file{fixfiletypes.py} script will change the file type and
|
|
||||||
creator codes for the indicated directory. To use
|
|
||||||
\file{fixfiletypes.py}:
|
|
||||||
|
|
||||||
\begin{enumerate}
|
|
||||||
\item
|
|
||||||
Locate it in the \file{scripts} folder of the \file{Mac} folder of the
|
|
||||||
MacPython distribution.
|
|
||||||
|
|
||||||
\item
|
|
||||||
Put all of the scripts that you want to fix in a folder with nothing
|
|
||||||
else in it.
|
|
||||||
|
|
||||||
\item
|
|
||||||
Double-click on the \file{fixfiletypes.py} icon.
|
|
||||||
|
|
||||||
\item
|
|
||||||
Navigate into the folder of files you want to fix, and press the
|
|
||||||
``Select current folder'' button.
|
|
||||||
\end{enumerate}
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{Simulating command line arguments
|
|
||||||
\label{argv}}
|
|
||||||
|
|
||||||
There are two ways to simulate command-line arguments with MacPython-OS9.
|
|
||||||
|
|
||||||
\begin{enumerate}
|
|
||||||
\item via Interpreter options
|
|
||||||
\begin{itemize} % nestable? I hope so!
|
|
||||||
\item Hold the option-key down when launching your script. This will
|
|
||||||
bring up a dialog box of Python Interpreter options.
|
|
||||||
\item Click ``Set \UNIX-style command line..'' button.
|
|
||||||
\item Type the arguments into the ``Argument'' field.
|
|
||||||
\item Click ``OK''
|
|
||||||
\item Click ``Run''.
|
|
||||||
\end{itemize} % end
|
|
||||||
|
|
||||||
\item via drag and drop
|
|
||||||
If you save the script as an applet (see Section \ref{IDEapplet}), you
|
|
||||||
can also simulate some command-line arguments via
|
|
||||||
``Drag-and-Drop''. In this case, the names of the files that were
|
|
||||||
dropped onto the applet will be appended to \code{sys.argv}, so that
|
|
||||||
it will appear to the script as though they had been typed on a
|
|
||||||
command line. As on \UNIX\ systems, the first item in \code{sys.srgv} is
|
|
||||||
the path to the applet, and the rest are the files dropped on the
|
|
||||||
applet.
|
|
||||||
\end{enumerate}
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{Creating a Python script}
|
|
||||||
|
|
||||||
Since Python scripts are simply text files, they can be created in any
|
|
||||||
way that text files can be created, but some special tools also exist
|
|
||||||
with extra features.
|
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{In an editor}
|
|
||||||
|
|
||||||
You can create a text file with any word processing program such as
|
|
||||||
\program{MSWord} or \program{AppleWorks} but you need to make sure
|
|
||||||
that the file is saved as ``\ASCII'' or ``plain text''. This also
|
|
||||||
works for \program{TextEdit}, but you need to use the command ``Make Plain Text``
|
|
||||||
in the ``Format`` menu before trying to save.
|
|
||||||
|
|
||||||
|
|
||||||
\subsubsection{Editors with Python modes}
|
|
||||||
|
|
||||||
Several text editors have additional features that add functionality
|
|
||||||
when you are creating a Python script. These can include coloring
|
|
||||||
Python keywords to make your code easier to read, module browsing, or
|
|
||||||
a built-in debugger. These include \program{Alpha}, \program{Pepper},
|
|
||||||
and \program{BBedit}, and the MacPython IDE (Section \ref{IDE}).
|
|
||||||
|
|
||||||
%\subsubsection{Alpha}
|
|
||||||
% **NEED INFO HERE**
|
|
||||||
|
|
||||||
\subsubsection{BBedit \label{scripting-with-BBedit}}
|
|
||||||
|
|
||||||
If you use \program{BBEdit} to create your scripts you will want to tell it about the Python creator code so that
|
|
||||||
you can simply double click on the saved file to launch it.
|
|
||||||
\begin{itemize}
|
|
||||||
\item Launch \program{BBEdit}.
|
|
||||||
\item Select ``Preferences'' from the ``Edit'' menu.
|
|
||||||
\item Select ``File Types'' from the scrolling list.
|
|
||||||
\item click on the ``Add...'' button and navigate to
|
|
||||||
\program{PythonInterpreter} in the main directory of the
|
|
||||||
MacPython distribution; click ``open''.
|
|
||||||
\item Click on the ``Save'' button in the Preferences panel.
|
|
||||||
\end{itemize}
|
|
||||||
% Are there additional BBedit Python-specific features? I'm not aware of any.
|
|
||||||
|
|
||||||
%\subsubsection{IDE}
|
|
||||||
%You can use the \program{Python IDE} supplied in the MacPython Distribution to create longer Python scripts
|
|
||||||
%-- see Section \ref{IDEwrite} for details.
|
|
||||||
|
|
||||||
%\subsubsection{IDLE}
|
|
||||||
%Idle is an IDE for Python that was written in Python, using TKInter. You should be able to use it on a Mac by following
|
|
||||||
%the standard documentation, but see Section \ref{TKInter} for guidance on using TKInter with MacPython.
|
|
||||||
|
|
||||||
%\subsubsection{Pepper}
|
|
||||||
% **NEED INFO HERE**
|
|
||||||
|
|
||||||
\subsection{Configuration \label{configuration}}
|
|
||||||
|
|
||||||
The MacPython distribution comes with \program{EditPythonPrefs}, an
|
|
||||||
applet which will help you to customize the MacPython environment for
|
|
||||||
your working habits.
|
|
||||||
|
|
||||||
\subsubsection{EditPythonPrefs\label{EditPythonPrefs}}
|
|
||||||
|
|
||||||
\program{EditPythonPrefs} gives you the capability to configure Python
|
|
||||||
to behave the way you want it to. There are two ways to use
|
|
||||||
\program{EditPythonPrefs}, you can use it to set the preferences in
|
|
||||||
general, or you can drop a particular Python engine onto it to
|
|
||||||
customize only that version. The latter can be handy if, for example,
|
|
||||||
you want to have a second copy of the \program{PythonInterpreter} that
|
|
||||||
keeps the output window open on a normal exit even though you prefer
|
|
||||||
to normally not work that way.
|
|
||||||
|
|
||||||
To change the default preferences, simply double-click on
|
|
||||||
\program{EditPythonPrefs}. To change the preferences only for one copy
|
|
||||||
of the Interpreter, drop the icon for that copy onto
|
|
||||||
\program{EditPythonPrefs}. You can also use \program{EditPythonPrefs}
|
|
||||||
in this fashion to set the preferences of the \program{Python IDE} and
|
|
||||||
any applets you create -- see section %s \ref{BuildApplet} and
|
|
||||||
\ref{IDEapplet}.
|
|
||||||
|
|
||||||
\subsubsection{Adding modules to the Module Search Path
|
|
||||||
\label{search-path}}
|
|
||||||
|
|
||||||
When executing an \keyword{import} statement, Python looks for modules
|
|
||||||
in places defined by the \member{sys.path} To edit the
|
|
||||||
\member{sys.path} on a Mac, launch \program{EditPythonPrefs}, and
|
|
||||||
enter them into the largish field at the top (one per line).
|
|
||||||
|
|
||||||
Since MacPython defines a main Python directory, the easiest thing is
|
|
||||||
to add folders to search within the main Python directory. To add a
|
|
||||||
folder of scripts that you created called ``My Folder'' located in the
|
|
||||||
main Python Folder, enter \samp{\$(PYTHON):My Folder} onto a new line.
|
|
||||||
|
|
||||||
To add the Desktop under OS 9 or below, add
|
|
||||||
\samp{StartupDriveName:Desktop Folder} on a new line.
|
|
||||||
|
|
||||||
\subsubsection{Default startup options \label{defaults}}
|
|
||||||
|
|
||||||
% I'm assuming that there exists some other documentation on the
|
|
||||||
% rest of the options so I only go over a couple here.
|
|
||||||
|
|
||||||
The ``Default startup options...'' button in the
|
|
||||||
\program{EditPythonPrefs} dialog box gives you many options including
|
|
||||||
the ability to keep the ``Output'' window open after the script
|
|
||||||
terminates, and the ability to enter interactive mode after the
|
|
||||||
termination of the run script. The latter can be very helpful if you
|
|
||||||
want to examine the objects that were created during your script.
|
|
||||||
|
|
||||||
%\section{Nifty Tools}
|
|
||||||
%There are many other tools included with the MacPython
|
|
||||||
%distribution. In addition to those discussed here, make
|
|
||||||
%sure to check the \file{Mac} directory.
|
|
||||||
|
|
||||||
%\subsection{BuildApplet \label{BuildApplet}}
|
|
||||||
% **NEED INFO HERE**
|
|
||||||
|
|
||||||
%\subsection{BuildApplication}
|
|
||||||
% **NEED INFO HERE**
|
|
||||||
|
|
||||||
%\section{TKInter on the Mac \label{TKInter}}
|
|
||||||
|
|
||||||
%TKinter is installed by default with the MacPython distribution, but
|
|
||||||
%you may need to add the \file{lib-tk} folder to the Python Path (see
|
|
||||||
%section \ref{search-path}). Also, it is important that you do not
|
|
||||||
%try to launch Tk from within the \program{Python IDE} because the two
|
|
||||||
%event loops will collide -- always run a script which uses Tkinter
|
|
||||||
%with the \program{PythonInterpreter} instead -- see section
|
|
||||||
%\ref{interpreter}.
|
|
||||||
|
|
||||||
%\section{CGI on the Mac with Python \label{CGI}}
|
|
||||||
%**NEED INFO HERE**
|
|
||||||
|
|
||||||
\section{The IDE\label{IDE}}
|
\section{The IDE\label{IDE}}
|
||||||
|
|
||||||
|
|
@ -365,15 +111,13 @@ The \program{Python IDE} (Integrated Development Environment) is a
|
||||||
separate application that acts as a text editor for your Python code,
|
separate application that acts as a text editor for your Python code,
|
||||||
a class browser, a graphical debugger, and more.
|
a class browser, a graphical debugger, and more.
|
||||||
|
|
||||||
|
The online Python Help contains a quick walkthrough of the IDE that
|
||||||
|
shows the major features and how to use them.
|
||||||
|
|
||||||
\subsection{Using the ``Python Interactive'' window}
|
\subsection{Using the ``Python Interactive'' window}
|
||||||
|
|
||||||
Use this window like you would the \program{PythonInterpreter}, except
|
Use this window like you would use a normal \UNIX{} command line
|
||||||
that you cannot use the ``Drag and drop'' method above. Instead,
|
interpreter.
|
||||||
dropping a script onto the \program{Python IDE} icon will open the
|
|
||||||
file in a separate script window (which you can then execute manually
|
|
||||||
-- see section \ref{IDEexecution}).
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{Writing a Python Script \label{IDEwrite}}
|
\subsection{Writing a Python Script \label{IDEwrite}}
|
||||||
|
|
||||||
|
|
@ -386,11 +130,6 @@ your currently open script by selecting the appropriate item in the
|
||||||
``File'' menu. Dropping a Python script onto the
|
``File'' menu. Dropping a Python script onto the
|
||||||
\program{Python IDE} will open it for editing.
|
\program{Python IDE} will open it for editing.
|
||||||
|
|
||||||
If you try to open a script with the \program{Python IDE} but either
|
|
||||||
can't locate it from the ``Open'' dialog box, or you get an error
|
|
||||||
message like ``Can't open file of type ...'' see section
|
|
||||||
\ref{creator-code}.
|
|
||||||
|
|
||||||
When the \program{Python IDE} saves a script, it uses the creator code
|
When the \program{Python IDE} saves a script, it uses the creator code
|
||||||
settings which are available by clicking on the small black triangle
|
settings which are available by clicking on the small black triangle
|
||||||
on the top right of the document window, and selecting ``save
|
on the top right of the document window, and selecting ``save
|
||||||
|
|
@ -398,8 +137,8 @@ options''. The default is to save the file with the \program{Python
|
||||||
IDE} as the creator, this means that you can open the file for editing
|
IDE} as the creator, this means that you can open the file for editing
|
||||||
by simply double-clicking on its icon. You might want to change this
|
by simply double-clicking on its icon. You might want to change this
|
||||||
behaviour so that it will be opened by the
|
behaviour so that it will be opened by the
|
||||||
\program{PythonInterpreter}, and run. To do this simply choose
|
\program{PythonLauncher}, and run. To do this simply choose
|
||||||
``Python Interpreter'' from the ``save options''. Note that these
|
``PythonLauncher'' from the ``save options''. Note that these
|
||||||
options are associated with the \emph{file} not the application.
|
options are associated with the \emph{file} not the application.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -449,4 +188,31 @@ system without a Python installation.
|
||||||
|
|
||||||
%\subsection{The ``Scripts'' menu}
|
%\subsection{The ``Scripts'' menu}
|
||||||
% **NEED INFO HERE**
|
% **NEED INFO HERE**
|
||||||
|
|
||||||
|
\section{The Package Manager}
|
||||||
|
|
||||||
|
Historically MacPython came with a number of useful extension packages
|
||||||
|
included, because most Macintosh users do not have access to a development
|
||||||
|
environment and C compiler. For Mac OS X that bundling is no longer done,
|
||||||
|
but a new mechanism has been made available to allow easy access to
|
||||||
|
extension packages.
|
||||||
|
|
||||||
|
The Python Package Manager helps you installing additional packages
|
||||||
|
that enhance Python. It determines the exact MacOS version and Python
|
||||||
|
version you have and uses that information to download a database that
|
||||||
|
has packages that are tested and tried on that combination. In other
|
||||||
|
words: if something is in your Package Manager window but does not work
|
||||||
|
you are free to blame the database maintainer.
|
||||||
|
|
||||||
|
PackageManager then checks which of the packages you have installed and
|
||||||
|
which ones are not. This should also work when you have installed packages
|
||||||
|
outside of PackageManager. You can select packages and install them,
|
||||||
|
and PackageManager will work out the requirements and install these too.
|
||||||
|
|
||||||
|
Often PackageManager will list a package in two flavors: binary and
|
||||||
|
source. Binary should always work, source will only work if you have
|
||||||
|
installed the Apple Developer Tools. PackageManager will warn you about
|
||||||
|
this, and also about other external dependencies.
|
||||||
|
|
||||||
|
PackageManager is available as a separate application and also as a
|
||||||
|
function of the IDE, through the File->Package Manager menu entry.
|
||||||
|
|
|
||||||
|
|
@ -3105,8 +3105,7 @@ in text files are automatically altered slightly when data is read or
|
||||||
written. This behind-the-scenes modification to file data is fine for
|
written. This behind-the-scenes modification to file data is fine for
|
||||||
\ASCII{} text files, but it'll corrupt binary data like that in JPEGs or
|
\ASCII{} text files, but it'll corrupt binary data like that in JPEGs or
|
||||||
\file{.EXE} files. Be very careful to use binary mode when reading and
|
\file{.EXE} files. Be very careful to use binary mode when reading and
|
||||||
writing such files. (Note that the precise semantics of text mode on
|
writing such files.
|
||||||
the Macintosh depends on the underlying C library being used.)
|
|
||||||
|
|
||||||
\subsection{Methods of File Objects \label{fileMethods}}
|
\subsection{Methods of File Objects \label{fileMethods}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue