This is /home/pdm/install/Python-2.1/Doc/lib/python-lib.info, produced
by makeinfo version 4.0 from lib.texi.

   April 15, 2001		2.1


File: python-lib.info,  Node: Process Management,  Next: Miscellaneous System Information,  Prev: Files and Directories,  Up: os

Process Management
------------------

   These functions may be used to create and manage processes.

   The various `exec*()' functions take a list of arguments for the new
program loaded into the process.  In each case, the first of these
arguments is passed to the new program as its own name rather than as
an argument a user may have typed on a command line.  For the C
programmer, this is the `argv[0]' passed to a program's `main()'.  For
example, `os.execv('/bin/echo', ['foo', 'bar'])' will only print `bar'
on standard output; `foo' will seem to be ignored.

`abort()'
     Generate a `SIGABRT' signal to the current process.  On UNIX, the
     default behavior is to produce a core dump; on Windows, the
     process immediately returns an exit code of `3'.  Be aware that
     programs which use `signal.signal()' to register a handler for
     `SIGABRT' will behave differently.  Availability: UNIX, Windows.

`execl(path, arg0, arg1, ...)'
     This is equivalent to `execv(PATH, (ARG0, ARG1, ...))'.
     Availability: UNIX, Windows.

`execle(path, arg0, arg1, ..., env)'
     This is equivalent to `execve(PATH, (ARG0, ARG1, ...), ENV)'.
     Availability: UNIX, Windows.

`execlp(path, arg0, arg1, ...)'
     This is equivalent to `execvp(PATH, (ARG0, ARG1, ...))'.
     Availability: UNIX, Windows.

`execv(path, args)'
     Execute the executable PATH with argument list ARGS, replacing the
     current process (i.e., the Python interpreter).  The argument list
     may be a tuple or list of strings.  Availability: UNIX, Windows.

`execve(path, args, env)'
     Execute the executable PATH with argument list ARGS, and
     environment ENV, replacing the current process (i.e., the Python
     interpreter).  The argument list may be a tuple or list of strings.
     The environment must be a dictionary mapping strings to strings.
     Availability: UNIX, Windows.

`execvp(path, args)'
     This is like `execv(PATH, ARGS)' but duplicates the shell's
     actions in searching for an executable file in a list of
     directories.  The directory list is obtained from
     `environ['PATH']'.  Availability: UNIX, Windows.

`execvpe(path, args, env)'
     This is a cross between `execve()' and `execvp()'.  The directory
     list is obtained from `ENV['PATH']'.  Availability: UNIX, Windows.

`_exit(n)'
     Exit to the system with status N, without calling cleanup
     handlers, flushing stdio buffers, etc.  Availability: UNIX,
     Windows.

     Note: the standard way to exit is `sys.exit(N)'.  `_exit()' should
     normally only be used in the child process after a `fork()'.

`fork()'
     Fork a child process.  Return `0' in the child, the child's
     process id in the parent.  Availability: UNIX.

`forkpty()'
     Fork a child process, using a new pseudo-terminal as the child's
     controlling terminal. Return a pair of `(PID, FD)', where PID is
     `0' in the child, the new child's process id in the parent, and
     `fd' is the file descriptor of the master end of the
     pseudo-terminal.  For a more portable approach, use the `pty'
     module.  Availability: Some flavors of UNIX

`kill(pid, sig)'
     Kill the process PID with signal SIG.  Availability: UNIX.

`nice(increment)'
     Add INCREMENT to the process's "niceness".  Return the new
     niceness.  Availability: UNIX.

`plock(op)'
     Lock program segments into memory.  The value of OP (defined in
     `<sys/lock.h>') determines which segments are locked.
     Availability: UNIX.

`spawnv(mode, path, args)'
     Execute the program PATH in a new process, passing the arguments
     specified in ARGS as command-line parameters.  ARGS may be a list
     or a tuple.  MODE is a magic operational constant.  See the Visual
     C++ Runtime Library documentation for further information; the
     constants are exposed to the Python programmer as listed below.
     Availability: UNIX, Windows.  _Added in Python version 1.5.2_

`spawnve(mode, path, args, env)'
     Execute the program PATH in a new process, passing the arguments
     specified in ARGS as command-line parameters and the contents of
     the mapping ENV as the environment.  ARGS may be a list or a
     tuple.  MODE is a magic operational constant.  See the Visual C++
     Runtime Library documentation for further information; the
     constants are exposed to the Python programmer as listed below.
     Availability: UNIX, Windows.  _Added in Python version 1.5.2_

`P_WAIT'

`P_NOWAIT'

`P_NOWAITO'
     Possible values for the MODE parameter to `spawnv()' and
     `spawnve()'.  Availability: UNIX, Windows.  _Added in Python
     version 1.5.2_

`P_OVERLAY'

`P_DETACH'
     Possible values for the MODE parameter to `spawnv()' and
     `spawnve()'.  These are less portable than those listed above.
     Availability: Windows.  _Added in Python version 1.5.2_

`startfile(path)'
     Start a file with its associated application.  This acts like
     double-clicking the file in Windows Explorer, or giving the file
     name as an argument to the DOS `start' command: the file is opened
     with whatever application (if any) its extension is associated.

     `startfile()' returns as soon as the associated application is
     launched.  There is no option to wait for the application to close,
     and no way to retrieve the application's exit status.  The PATH
     parameter is relative to the current directory.  If you want to
     use an absolute path, make sure the first character is not a slash
     (`/'); the underlying Win32 `ShellExecute()' function doesn't work
     it is.  Use the `os.path.normpath()' function to ensure that the
     path is properly encoded for Win32.  Availability: Windows.
     _Added in Python version 2.0_

`system(command)'
     Execute the command (a string) in a subshell.  This is implemented
     by calling the Standard C function `system()', and has the same
     limitations.  Changes to `posix.environ', `sys.stdin', etc. are
     not reflected in the environment of the executed command.  The
     return value is the exit status of the process encoded in the
     format specified for `wait()', except on Windows 95 and 98, where
     it is always `0'.  Note that POSIX does not specify the meaning of
     the return value of the C `system()' function, so the return value
     of the Python function is system-dependent.  Availability: UNIX,
     Windows.

`times()'
     Return a 5-tuple of floating point numbers indicating accumulated
     (CPU or other) times, in seconds.  The items are: user time,
     system time, children's 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 `times(2)' or the corresponding Windows
     Platform API documentation.  Availability: UNIX, Windows.

`wait()'
     Wait for completion of a child process, and return a tuple
     containing 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 exit status (if the signal number is zero);
     the high bit of the low byte is set if a core file was produced.
     Availability: UNIX.

`waitpid(pid, options)'
     Wait for completion of a child process given by process id PID,
     and return a tuple containing its process id and exit status
     indication (encoded as for `wait()').  The semantics of the call
     are affected by the value of the integer OPTIONS, which should be
     `0' for normal operation.  Availability: UNIX.

     If PID is greater than `0', `waitpid()' requests status
     information for that specific process.  If PID is `0', the request
     is for the status of any child in the process group of the current
     process.  If PID is `-1', the request pertains to any child of the
     current process.  If PID is less than `-1', status is requested
     for any process in the process group `-PID' (the absolute value of
     PID).

`WNOHANG'
     The option for `waitpid()' to avoid hanging if no child process
     status is available immediately.  Availability: UNIX.

   The following functions take a process status code as returned by
`system()', `wait()', or `waitpid()' as a parameter.  They may be used
to determine the disposition of a process.

`WIFSTOPPED(status)'
     Return true if the process has been stopped.  Availability: UNIX.

`WIFSIGNALED(status)'
     Return true if the process exited due to a signal.  Availability:
     UNIX.

`WIFEXITED(status)'
     Return true if the process exited using the `exit(2)' system call.
     Availability: UNIX.

`WEXITSTATUS(status)'
     If `WIFEXITED(STATUS)' is true, return the integer parameter to
     the `exit(2)' system call.  Otherwise, the return value is
     meaningless.  Availability: UNIX.

`WSTOPSIG(status)'
     Return the signal which caused the process to stop.  Availability:
     UNIX.

`WTERMSIG(status)'
     Return the signal which caused the process to exit.  Availability:
     UNIX.


File: python-lib.info,  Node: Miscellaneous System Information,  Prev: Process Management,  Up: os

Miscellaneous System Information
--------------------------------

`confstr(name)'
     Return string-valued system configuration values.  NAME specifies
     the configuration value to retrieve; it may be a string which is
     the name of a defined system value; these names are specified in a
     number of standards (POSIX, Unix95, Unix98, and others).  Some
     platforms define additional names as well.  The names known to the
     host operating system are given in the `confstr_names' dictionary.
     For configuration variables not included in that mapping, passing
     an integer for NAME is also accepted.  Availability: UNIX.

     If the configuration value specified by NAME isn't defined, the
     empty string is returned.

     If NAME is a string and is not known, `ValueError' is raised.  If
     a specific value for NAME is not supported by the host system,
     even if it is included in `confstr_names', an `OSError' is raised
     with `errno.EINVAL' for the error number.

`confstr_names'
     Dictionary mapping names accepted by `confstr()' to the 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.
     Availability: UNIX.

`sysconf(name)'
     Return integer-valued system configuration values.  If the
     configuration value specified by NAME isn't defined, `-1' is
     returned.  The comments regarding the NAME parameter for
     `confstr()' apply here as well; the dictionary that provides
     information on the known names is given by `sysconf_names'.
     Availability: UNIX.

`sysconf_names'
     Dictionary mapping names accepted by `sysconf()' to the 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.
     Availability: UNIX.

   The follow data values are used to support path manipulation
operations.  These are defined for all platforms.

   Higher-level operations on pathnames are defined in the `os.path'
module.

`curdir'
     The constant string used by the OS to refer to the current
     directory, e.g. `'.'' for POSIX or `':'' for the Macintosh.

`pardir'
     The constant string used by the OS to refer to the parent
     directory, e.g. `'..'' for POSIX or `'::'' for the Macintosh.

`sep'
     The character used by the OS to separate pathname components, e.g.
     `/' for POSIX or `:' for the Macintosh.  Note that knowing this is
     not sufficient to be able to parse or concatenate pathnames -- use
     `os.path.split()' and `os.path.join()' -- but it is occasionally
     useful.

`altsep'
     An alternative character used by the OS to separate pathname
     components, or `None' if only one separator character exists.
     This is set to `/' on DOS and Windows systems where `sep' is a
     backslash.

`pathsep'
     The character conventionally used by the OS to separate search
     patch components (as in `PATH'), e.g. `:' for POSIX or `;' for DOS
     and Windows.

`defpath'
     The default search path used by `exec*p*()' if the environment
     doesn't have a `'PATH'' key.

`linesep'
     The string used to separate (or, rather, terminate) lines on the
     current platform.  This may be a single character, e.g. `'\n'' for
     POSIX or `'\r'' for MacOS, or multiple characters, e.g. `'\r\n''
     for MS-DOS and MS Windows.


File: python-lib.info,  Node: os.path,  Next: dircache,  Prev: os,  Up: Generic Operating System Services

Common pathname manipulations
=============================

   Common pathname manipulations.

   This module implements some useful functions on pathnames.

`abspath(path)'
     Return a normalized absolutized version of the pathname PATH.  On
     most platforms, this is equivalent to `normpath(join(os.getcwd(),
     PATH))'.  _Added in Python version 1.5.2_

`basename(path)'
     Return the base name of pathname PATH.  This is the second half of
     the pair returned by `split(PATH)'.  Note that the result of this
     function is different from the UNIX `basename' program; where
     `basename' for `'/foo/bar/'' returns `'bar'', the `basename()'
     function returns an empty string (`''').

`commonprefix(list)'
     Return the longest path prefix (taken character-by-character) that
     is a prefix of all paths in LIST.  If LIST is empty, return the
     empty string (`''').  Note that this may return invalid paths
     because it works a character at a time.

`dirname(path)'
     Return the directory name of pathname PATH.  This is the first
     half of the pair returned by `split(PATH)'.

`exists(path)'
     Return true if PATH refers to an existing path.

`expanduser(path)'
     Return the argument with an initial component of `~' or `~USER'
     replaced by that USER's home directory.  An initial `~{}' is
     replaced by the environment variable `HOME'; an initial `~USER' is
     looked up in the password directory through the built-in module
     `pwd'.  If the expansion fails, or if the path does not begin with
     a tilde, the path is returned unchanged.  On the Macintosh, this
     always returns PATH unchanged.

`expandvars(path)'
     Return the argument with environment variables expanded.
     Substrings of the form `$NAME' or `${NAME}' are replaced by the
     value of environment variable NAME.  Malformed variable names and
     references to non-existing variables are left unchanged.  On the
     Macintosh, this always returns PATH unchanged.

`getatime(path)'
     Return the time of last access of FILENAME.  The return value is
     integer giving the number of seconds since the epoch (see the
     `time' module).  Raise `os.error' if the file does not exist or is
     inaccessible.  _Added in Python version 1.5.2_

`getmtime(path)'
     Return the time of last modification of FILENAME.  The return
     value is integer giving the number of seconds since the epoch (see
     the `time' module).  Raise `os.error' if the file does not exist
     or is inaccessible.  _Added in Python version 1.5.2_

`getsize(path)'
     Return the size, in bytes, of FILENAME.  Raise `os.error' if the
     file does not exist or is inaccessible.  _Added in Python version
     1.5.2_

`isabs(path)'
     Return true if PATH is an absolute pathname (begins with a slash).

`isfile(path)'
     Return true if PATH is an existing regular file.  This follows
     symbolic links, so both `islink()' and `isfile()' can be true for
     the same path.

`isdir(path)'
     Return true if PATH is an existing directory.  This follows
     symbolic links, so both `islink()' and `isdir()' can be true for
     the same path.

`islink(path)'
     Return true if PATH refers to a directory entry that is a symbolic
     link.  Always false if symbolic links are not supported.

`ismount(path)'
     Return true if pathname PATH is a "mount point": a point in a file
     system where a different file system has been mounted.  The
     function checks whether PATH's parent, `PATH/..', is on a
     different device than PATH, or whether `PATH/..' and PATH point to
     the same i-node on the same device -- this should detect mount
     points for all UNIX and POSIX variants.

`join(path1[, path2[, ...]])'
     Joins one or more path components intelligently.  If any component
     is an absolute path, all previous components are thrown away, and
     joining continues.  The return value is the concatenation of
     PATH1, and optionally PATH2, etc., with exactly one slash (`'/'')
     inserted between components, unless PATH is empty.

`normcase(path)'
     Normalize the case of a pathname.  On UNIX, this returns the path
     unchanged; on case-insensitive filesystems, it converts the path to
     lowercase.  On Windows, it also converts forward slashes to
     backward slashes.

`normpath(path)'
     Normalize a pathname.  This collapses redundant separators and
     up-level references, e.g. `A//B', `A/./B' and `A/foo/../B' all
     become `A/B'.  It does not normalize the case (use `normcase()'
     for that).  On Windows, it converts forward slashes to backward
     slashes.

`samefile(path1, path2)'
     Return true if both pathname arguments refer to the same file or
     directory (as indicated by device number and i-node number).
     Raise an exception if a `os.stat()' call on either pathname fails.
     Availability:  Macintosh, UNIX.

`sameopenfile(fp1, fp2)'
     Return true if the file objects FP1 and FP2 refer to the same
     file.  The two file objects may represent different file
     descriptors.  Availability:  Macintosh, UNIX.

`samestat(stat1, stat2)'
     Return true if the stat tuples STAT1 and STAT2 refer to the same
     file.  These structures may have been returned by `fstat()',
     `lstat()', or `stat()'.  This function implements the underlying
     comparison used by `samefile()' and `sameopenfile()'.
     Availability:  Macintosh, UNIX.

`split(path)'
     Split the pathname PATH into a pair, `(HEAD, TAIL)' where TAIL is
     the last pathname component and HEAD is everything leading up to
     that.  The TAIL part will never contain a slash; if PATH ends in a
     slash, TAIL will be empty.  If there is no slash in PATH, HEAD
     will be empty.  If PATH is empty, both HEAD and TAIL are empty.
     Trailing slashes are stripped from HEAD unless it is the root (one
     or more slashes only).  In nearly all cases, `join(HEAD, TAIL)'
     equals PATH (the only exception being when there were multiple
     slashes separating HEAD from TAIL).

`splitdrive(path)'
     Split the pathname PATH into a pair `(DRIVE, TAIL)' where DRIVE is
     either a drive specification or the empty string.  On systems
     which do not use drive specifications, DRIVE will always be the
     empty string.  In all cases, `DRIVE + TAIL' will be the same as
     PATH.

`splitext(path)'
     Split the pathname PATH into a pair `(ROOT, EXT)' such that `ROOT
     + EXT == PATH', and EXT is empty or begins with a period and
     contains at most one period.

`walk(path, visit, arg)'
     Calls the function VISIT with arguments `(ARG, DIRNAME, NAMES)'
     for each directory in the directory tree rooted at PATH (including
     PATH itself, if it is a directory).  The argument DIRNAME
     specifies the visited directory, the argument NAMES lists the
     files in the directory (gotten from `os.listdir(DIRNAME)').  The
     VISIT function may modify NAMES to influence the set of
     directories visited below DIRNAME, e.g., to avoid visiting certain
     parts of the tree.  (The object referred to by NAMES must be
     modified in place, using `del' or slice assignment.)


File: python-lib.info,  Node: dircache,  Next: stat,  Prev: os.path,  Up: Generic Operating System Services

Cached directory listings
=========================

   This section was written by Moshe Zadka <moshez@zadka.site.co.il>.
Return directory listing, with cache mechanism.

   The `dircache' module defines a function for reading directory
listing using a cache, and cache invalidation using the MTIME of the
directory.  Additionally, it defines a function to annotate directories
by appending a slash.

   The `dircache' module defines the following functions:

`listdir(path)'
     Return a directory listing of PATH, as gotten from `os.listdir()'.
     Note that unless PATH changes, further call to `listdir()' will
     not re-read the directory structure.

     Note that the list returned should be regarded as read-only.
     (Perhaps a future version should change it to return a tuple?)

`opendir(path)'
     Same as `listdir()'. Defined for backwards compatibility.

`annotate(head, list)'
     Assume LIST is a list of paths relative to HEAD, and append, in
     place, a `/' to each path which points to a directory.

     >>> import dircache
     >>> a=dircache.listdir('/')
     >>> a=a[:] # Copy the return value so we can change 'a'
     >>> a
     ['bin', 'boot', 'cdrom', 'dev', 'etc', 'floppy', 'home', 'initrd', 'lib', 'lost+
     found', 'mnt', 'proc', 'root', 'sbin', 'tmp', 'usr', 'var', 'vmlinuz']
     >>> dircache.annotate('/', a)
     >>> a
     ['bin/', 'boot/', 'cdrom/', 'dev/', 'etc/', 'floppy/', 'home/', 'initrd/', 'lib/
     ', 'lost+found/', 'mnt/', 'proc/', 'root/', 'sbin/', 'tmp/', 'usr/', 'var/', 'vm
     linuz']


File: python-lib.info,  Node: stat,  Next: statcache,  Prev: dircache,  Up: Generic Operating System Services

Interpreting `stat()' results
=============================

   Utilities for interpreting the results of `os.stat()', `os.lstat()'
and `os.fstat()'.

   This section was written by Skip Montanaro <skip@automatrix.com>.
The `stat' module defines constants and functions for interpreting the
results of `os.stat()', `os.fstat()' and `os.lstat()' (if they exist).
For complete details about the `stat()', `fstat()' and `lstat()' calls,
consult the documentation for your system.

   The `stat' module defines the following functions to test for
specific file types:

`S_ISDIR(mode)'
     Return non-zero if the mode is from a directory.

`S_ISCHR(mode)'
     Return non-zero if the mode is from a character special device
     file.

`S_ISBLK(mode)'
     Return non-zero if the mode is from a block special device file.

`S_ISREG(mode)'
     Return non-zero if the mode is from a regular file.

`S_ISFIFO(mode)'
     Return non-zero if the mode is from a FIFO (named pipe).

`S_ISLNK(mode)'
     Return non-zero if the mode is from a symbolic link.

`S_ISSOCK(mode)'
     Return non-zero if the mode is from a socket.

   Two additional functions are defined for more general manipulation of
the file's mode:

`S_IMODE(mode)'
     Return the portion of the file's mode that can be set by
     `os.chmod()'--that is, the file's permission bits, plus the sticky
     bit, set-group-id, and set-user-id bits (on systems that support
     them).

`S_IFMT(mode)'
     Return the portion of the file's mode that describes the file type
     (used by the `S_IS*()' functions above).

   Normally, you would use the `os.path.is*()' functions for testing
the type of a file; the functions here are useful when you are doing
multiple tests of the same file and wish to avoid the overhead of the
`stat()' system call for each test.  These are also useful when
checking for information about a file that isn't handled by `os.path',
like the tests for block and character devices.

   All the variables below are simply symbolic indexes into the 10-tuple
returned by `os.stat()', `os.fstat()' or `os.lstat()'.

`ST_MODE'
     Inode protection mode.

`ST_INO'
     Inode number.

`ST_DEV'
     Device inode resides on.

`ST_NLINK'
     Number of links to the inode.

`ST_UID'
     User id of the owner.

`ST_GID'
     Group id of the owner.

`ST_SIZE'
     Size in bytes of a plain file; amount of data waiting on some
     special files.

`ST_ATIME'
     Time of last access.

`ST_MTIME'
     Time of last modification.

`ST_CTIME'
     Time of last status change (see manual pages for details).

   The interpretation of "file size" changes according to the file
type.  For plain files this is the size of the file in bytes.  For
FIFOs and sockets under most Unixes (including Linux in particular),
the "size" is the number of bytes waiting to be read at the time of the
call to `os.stat()', `os.fstat()', or `os.lstat()'; this can sometimes
be useful, especially for polling one of these special files after a
non-blocking open.  The meaning of the size field for other character
and block devices varies more, depending on the implementation of the
underlying system call.

   Example:

     import os, sys
     from stat import *
     
     def walktree(dir, callback):
         '''recursively descend the directory rooted at dir,
            calling the callback function for each regular file'''
     
         for f in os.listdir(dir):
             pathname = '%s/%s' % (dir, f)
             mode = os.stat(pathname)[ST_MODE]
             if S_ISDIR(mode):
                 # It's a directory, recurse into it
                 walktree(pathname, callback)
             elif S_ISREG(mode):
                 # It's a file, call the callback function
                 callback(pathname)
             else:
                 # Unknown file type, print a message
                 print 'Skipping %s' % pathname
     
     def visitfile(file):
         print 'visiting', file
     
     if __name__ == '__main__':
         walktree(sys.argv[1], visitfile)


File: python-lib.info,  Node: statcache,  Next: statvfs,  Prev: stat,  Up: Generic Operating System Services

An optimization of `os.stat()'
==============================

   This section was written by Moshe Zadka <moshez@zadka.site.co.il>.
Stat files, and remember results.

   The `statcache' module provides a simple optimization to
`os.stat()': remembering the values of previous invocations.

   The `statcache' module defines the following functions:

`stat(path)'
     This is the main module entry-point.  Identical for `os.stat()',
     except for remembering the result for future invocations of the
     function.

   The rest of the functions are used to clear the cache, or parts of
it.

`reset()'
     Clear the cache: forget all results of previous `stat()' calls.

`forget(path)'
     Forget the result of `stat(PATH)', if any.

`forget_prefix(prefix)'
     Forget all results of `stat(PATH)' for PATH starting with PREFIX.

`forget_dir(prefix)'
     Forget all results of `stat(PATH)' for PATH a file in the
     directory PREFIX, including `stat(PREFIX)'.

`forget_except_prefix(prefix)'
     Similar to `forget_prefix()', but for all PATH values _not_
     starting with PREFIX.

   Example:

     >>> import os, statcache
     >>> statcache.stat('.')
     (16893, 2049, 772, 18, 1000, 1000, 2048, 929609777, 929609777, 929609777)
     >>> os.stat('.')
     (16893, 2049, 772, 18, 1000, 1000, 2048, 929609777, 929609777, 929609777)


File: python-lib.info,  Node: statvfs,  Next: filecmp,  Prev: statcache,  Up: Generic Operating System Services

Constants used with `os.statvfs()'
==================================

   This section was written by Moshe Zadka <moshez@zadka.site.co.il>.
Constants for interpreting the result of `os.statvfs()'.

   The `statvfs' module defines constants so interpreting the result if
`os.statvfs()', which returns a tuple, can be made without remembering
"magic numbers."  Each of the constants defined in this module is the
_index_ of the entry in the tuple returned by `os.statvfs()' that
contains the specified information.

`F_BSIZE'
     Preferred file system block size.

`F_FRSIZE'
     Fundamental file system block size.

`F_BLOCKS'
     Total number of blocks in the filesystem.

`F_BFREE'
     Total number of free blocks.

`F_BAVAIL'
     Free blocks available to non-super user.

`F_FILES'
     Total number of file nodes.

`F_FFREE'
     Total number of free file nodes.

`F_FAVAIL'
     Free nodes available to non-super user.

`F_FLAG'
     Flags. System dependent: see `statvfs()' man page.

`F_NAMEMAX'
     Maximum file name length.


File: python-lib.info,  Node: filecmp,  Next: popen2,  Prev: statvfs,  Up: Generic Operating System Services

File and Directory Comparisons
==============================

   This section was written by Moshe Zadka <moshez@zadka.site.co.il>.
Compare files efficiently.

   The `filecmp' module defines functions to compare files and
directories, with various optional time/correctness trade-offs.

   The `filecmp' module defines the following function:

`cmp(f1, f2[, shallow[, use_statcache]])'
     Compare the files named F1 and F2, returning `1' if they seem
     equal, `0' otherwise.

     Unless SHALLOW is given and is false, files with identical
     `os.stat()' signatures are taken to be equal.  If USE_STATCACHE is
     given and is true, `statcache.stat()' will be called rather then
     `os.stat()'; the default is to use `os.stat()'.

     Files that were compared using this function will not be compared
     again unless their `os.stat()' signature changes. Note that using
     USE_STATCACHE true will cause the cache invalidation mechanism to
     fail -- the stale stat value will be used from `statcache''s cache.

     Note that no external programs are called from this function,
     giving it portability and efficiency.

`cmpfiles(dir1, dir2, common[, shallow[, use_statcache]])'
     Returns three lists of file names: MATCH, MISMATCH, ERRORS.  MATCH
     contains the list of files match in both directories, MISMATCH
     includes the names of those that don't, and ERRROS lists the names
     of files which could not be compared.  Files may be listed in
     ERRORS because the user may lack permission to read them or many
     other reasons, but always that the comparison could not be done
     for some reason.

     The SHALLOW and USE_STATCACHE parameters have the same meanings
     and default values as for `filecmp.cmp()'.

   Example:

     >>> import filecmp
     >>> filecmp.cmp('libundoc.tex', 'libundoc.tex')
     1
     >>> filecmp.cmp('libundoc.tex', 'lib.tex')
     0

* Menu:

* dircmp class::


File: python-lib.info,  Node: dircmp class,  Prev: filecmp,  Up: filecmp

The `dircmp' class
------------------

`dircmp(a, b[, ignore[, hide]])'
     Construct a new directory comparison object, to compare the
     directories A and B. IGNORE is a list of names to ignore, and
     defaults to `['RCS', 'CVS', 'tags']'. HIDE is a list of names to
     hide, and defaults to `[os.curdir, os.pardir]'.

`report()'
     Print (to `sys.stdout') a comparison between A and B.

`report_partial_closure()'
     Print a comparison between A and B and common immediate
     subdirctories.

`report_full_closure()'
     Print a comparison between A and B and common subdirctories
     (recursively).

`left_list'
     Files and subdirectories in A, filtered by HIDE and IGNORE.

`right_list'
     Files and subdirectories in B, filtered by HIDE and IGNORE.

`common'
     Files and subdirectories in both A and B.

`left_only'
     Files and subdirectories only in A.

`right_only'
     Files and subdirectories only in B.

`common_dirs'
     Subdirectories in both A and B.

`common_files'
     Files in both A and B

`common_funny'
     Names in both A and B, such that the type differs between the
     directories, or names for which `os.stat()' reports an error.

`same_files'
     Files which are identical in both A and B.

`diff_files'
     Files which are in both A and B, whose contents differ.

`funny_files'
     Files which are in both A and B, but could not be compared.

`subdirs'
     A dictionary mapping names in `common_dirs' to `dircmp' objects.

   Note that via `__getattr__()' hooks, all attributes are computed
lazilly, so there is no speed penalty if only those attributes which
are lightweight to compute are used.


File: python-lib.info,  Node: popen2,  Next: time,  Prev: filecmp,  Up: Generic Operating System Services

Subprocesses with accessible I/O streams
========================================

   Subprocesses with accessible standard I/O streams.

   This section was written by Drew Csillag
<drew_csillag@geocities.com>.
This module allows you to spawn processes and connect to their
input/output/error pipes and obtain their return codes under UNIX and
Windows.

   Note that starting with Python 2.0, this functionality is available
using functions from the `os' module which have the same names as the
factory functions here, but the order of the return values is more
intuitive in the `os' module variants.

   The primary interface offered by this module is a trio of factory
functions.  For each of these, if BUFSIZE is specified, it specifies
the buffer size for the I/O pipes.  MODE, if provided, should be the
string `'b'' or `'t''; on Windows this is needed to determine whether
the file objects should be opened in binary or text mode.  The default
value for MODE is `'t''.

`popen2(cmd[, bufsize[, mode]])'
     Executes CMD as a sub-process.  Returns the file objects
     `(CHILD_STDOUT, CHILD_STDIN)'.

`popen3(cmd[, bufsize[, mode]])'
     Executes CMD as a sub-process.  Returns the file objects
     `(CHILD_STDOUT, CHILD_STDIN, CHILD_STDERR)'.

`popen4(cmd[, bufsize[, mode]])'
     Executes CMD as a sub-process.  Returns the file objects
     `(CHILD_STDOUT_AND_STDERR, CHILD_STDIN)'.  _Added in Python
     version 2.0_

   On UNIX, a class defining the objects returned by the factory
functions is also available.  These are not used for the Windows
implementation, and are not available on that platform.

`Popen3(cmd[, capturestderr[, bufsize]])'
     This class represents a child process.  Normally, `Popen3'
     instances are created using the `popen2()' and `popen3()' factory
     functions described above.

     If not using one off the helper functions to create `Popen3'
     objects, the parameter CMD is the shell command to execute in a
     sub-process.  The CAPTURESTDERR flag, if true, specifies that the
     object should capture standard error output of the child process.
     The default is false.  If the BUFSIZE parameter is specified, it
     specifies the size of the I/O buffers to/from the child process.

`Popen4(cmd[, bufsize])'
     Similar to `Popen3', but always captures standard error into the
     same file object as standard output.  These are typically created
     using `popen4()'.  _Added in Python version 2.0_

* Menu:

* Popen3 and Popen4 Objects::


File: python-lib.info,  Node: Popen3 and Popen4 Objects,  Prev: popen2,  Up: popen2

Popen3 and Popen4 Objects
-------------------------

   Instances of the `Popen3' and `Popen4' classes have the following
methods:

`poll()'
     Returns `-1' if child process hasn't completed yet, or its return
     code otherwise.

`wait()'
     Waits for and returns the return code of the child process.

   The following attributes are also available:

`fromchild'
     A file object that provides output from the child process.  For
     `Popen4' instances, this will provide both the standard output and
     standard error streams.

`tochild'
     A file object that provides input to the child process.

`childerr'
     Where the standard error from the child process goes is
     CAPTURESTDERR was true for the constructor, or `None'.  This will
     always be `None' for `Popen4' instances.

`pid'
     The process ID of the child process.

