summaryrefslogtreecommitdiffstats
path: root/Doc/library/os.rst
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-12 19:39:10 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-12 19:39:10 (GMT)
commita62da1daafc63075c08088f45750152a4974e7b8 (patch)
tree3b70d95989fcae7e012ff32d523863d9e6eef5a5 /Doc/library/os.rst
parent25bb783c030cd1c4f13297f3e2e1b6246d3f0a0c (diff)
downloadcpython-a62da1daafc63075c08088f45750152a4974e7b8.zip
cpython-a62da1daafc63075c08088f45750152a4974e7b8.tar.gz
cpython-a62da1daafc63075c08088f45750152a4974e7b8.tar.bz2
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line Speed-up and simplify code urlparse's result objects. ........ r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line Bug #1790: update link; remove outdated paragraph ........ r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines Raise an error instead of crashing with a segfault when a NULL function pointer is called. Will backport to release25-maint. ........ r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines Fix a potential 'SystemError: NULL result without error'. NULL may be a valid return value from PyLong_AsVoidPtr. Will backport to release25-maint. ........ r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line Update the opcode docs for STORE_MAP and BUILD_MAP ........ r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines Issue 1780: Allow leading and trailing whitespace in Decimal constructor, when constructing from a string. Disallow trailing newlines in Context.create_decimal. ........ r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines Move OSError docs to exceptions doc, remove obsolete descriptions from os docs, rework posix docs. ........ r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines Patch #1700288: Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs. ........ r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines Fix editing glitch. ........
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r--Doc/library/os.rst61
1 files changed, 19 insertions, 42 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index ee0cf48..c4f6e64 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1,4 +1,3 @@
-
:mod:`os` --- Miscellaneous operating system interfaces
=======================================================
@@ -6,53 +5,32 @@
:synopsis: Miscellaneous operating system interfaces.
-This module provides a more portable way of using operating system dependent
-functionality than importing an operating system dependent built-in module like
-:mod:`posix` or :mod:`nt`. If you just want to read or write a file see
-:func:`open`, if you want to manipulate paths, see the :mod:`os.path`
-module, and if you want to read all the lines in all the files on the
-command line see the :mod:`fileinput` module. For creating temporary
-files and directories see the :mod:`tempfile` module, and for high-level
-file and directory handling see the :mod:`shutil` module.
-
-This module searches for an operating system dependent built-in module like
-:mod:`mac` or :mod:`posix` and exports the same functions and data as found
-there. The design of all built-in operating system dependent modules of Python
-is such that as long as the same functionality is available, it uses the same
-interface; for example, the function ``os.stat(path)`` returns stat information
-about *path* in the same format (which happens to have originated with the POSIX
+This module provides a portable way of using operating system dependent
+functionality. If you just want to read or write a file see :func:`open`, if
+you want to manipulate paths, see the :mod:`os.path` module, and if you want to
+read all the lines in all the files on the command line see the :mod:`fileinput`
+module. For creating temporary files and directories see the :mod:`tempfile`
+module, and for high-level file and directory handling see the :mod:`shutil`
+module.
+
+The design of all built-in operating system dependent modules of Python is such
+that as long as the same functionality is available, it uses the same interface;
+for example, the function ``os.stat(path)`` returns stat information about
+*path* in the same format (which happens to have originated with the POSIX
interface).
Extensions peculiar to a particular operating system are also available through
the :mod:`os` module, but using them is of course a threat to portability!
-Note that after the first time :mod:`os` is imported, there is *no* performance
-penalty in using functions from :mod:`os` instead of directly from the operating
-system dependent built-in module, so there should be *no* reason not to use
-:mod:`os`!
+.. note::
-The :mod:`os` module contains many functions and data values. The items below
-and in the following sub-sections are all available directly from the :mod:`os`
-module.
+ All functions in this module raise :exc:`OSError` in the case of invalid or
+ inaccessible file names and paths, or other arguments that have the correct
+ type, but are not accepted by the operating system.
.. exception:: error
- .. index:: module: errno
-
- This exception is raised when a function returns a system-related error (not for
- illegal argument types or other incidental errors). This is also known as the
- built-in exception :exc:`OSError`. The accompanying value is a pair containing
- the numeric error code from :cdata:`errno` and the corresponding string, as
- would be printed by the C function :cfunc:`perror`. See the module
- :mod:`errno`, which contains names for the error codes defined by the underlying
- operating system.
-
- When exceptions are classes, this exception carries two attributes,
- :attr:`errno` and :attr:`strerror`. The first holds the value of the C
- :cdata:`errno` variable, and the latter holds the corresponding error message
- from :cfunc:`strerror`. For exceptions that involve a file system path (such as
- :func:`chdir` or :func:`unlink`), the exception instance will contain a third
- attribute, :attr:`filename`, which is the file name passed to the function.
+ An alias for the built-in :exc:`OSError` exception.
.. data:: name
@@ -645,7 +623,6 @@ platforms. For descriptions of their availability and use, consult
Files and Directories
---------------------
-
.. function:: access(path, mode)
Use the real uid/gid to test for access to *path*. Note that most operations
@@ -1760,8 +1737,8 @@ Miscellaneous System Information
.. function:: getloadavg()
- Return the number of processes in the system run queue averaged over the last 1,
- 5, and 15 minutes or raises :exc:`OSError` if the load average was
+ Return the number of processes in the system run queue averaged over the last
+ 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was
unobtainable.