Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7)

Side by Side Diff: Doc/library/os.rst

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/os.path.rst ('k') | Doc/library/packaging.compiler.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`os` --- Miscellaneous operating system interfaces 1 :mod:`os` --- Miscellaneous operating system interfaces
2 ======================================================= 2 =======================================================
3 3
4 .. module:: os 4 .. module:: os
5 :synopsis: Miscellaneous operating system interfaces. 5 :synopsis: Miscellaneous operating system interfaces.
6 6
7 7
8 This module provides a portable way of using operating system dependent 8 This module provides a portable way of using operating system dependent
9 functionality. If you just want to read or write a file see :func:`open`, if 9 functionality. If you just want to read or write a file see :func:`open`, if
10 you want to manipulate paths, see the :mod:`os.path` module, and if you want to 10 you want to manipulate paths, see the :mod:`os.path` module, and if you want to
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 .. exception:: error 53 .. exception:: error
54 54
55 An alias for the built-in :exc:`OSError` exception. 55 An alias for the built-in :exc:`OSError` exception.
56 56
57 57
58 .. data:: name 58 .. data:: name
59 59
60 The name of the operating system dependent module imported. The following 60 The name of the operating system dependent module imported. The following
61 names have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``, 61 names have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``,
62 ``'os2'``, ``'ce'``, ``'java'``. 62 ``'os2'``, ``'ce'``, ``'java'``.
63
64 .. seealso::
65 :attr:`sys.platform` has a finer granularity. :func:`os.uname` gives
66 system-dependent version information.
67
68 The :mod:`platform` module provides detailed checks for the
69 system's identity.
70 63
71 64
72 .. _os-filenames: 65 .. _os-filenames:
73 66
74 File Names, Command Line Arguments, and Environment Variables 67 File Names, Command Line Arguments, and Environment Variables
75 ------------------------------------------------------------- 68 -------------------------------------------------------------
76 69
77 In Python, file names, command line arguments, and environment variables are 70 In Python, file names, command line arguments, and environment variables are
78 represented using the string type. On some systems, decoding these strings to 71 represented using the string type. On some systems, decoding these strings to
79 and from bytes is necessary before passing them to the operating system. Python 72 and from bytes is necessary before passing them to the operating system. Python
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 .. function:: chflags(path, flags) 1458 .. function:: chflags(path, flags)
1466 1459
1467 Set the flags of *path* to the numeric *flags*. *flags* may take a combinatio n 1460 Set the flags of *path* to the numeric *flags*. *flags* may take a combinatio n
1468 (bitwise OR) of the following values (as defined in the :mod:`stat` module): 1461 (bitwise OR) of the following values (as defined in the :mod:`stat` module):
1469 1462
1470 * :data:`stat.UF_NODUMP` 1463 * :data:`stat.UF_NODUMP`
1471 * :data:`stat.UF_IMMUTABLE` 1464 * :data:`stat.UF_IMMUTABLE`
1472 * :data:`stat.UF_APPEND` 1465 * :data:`stat.UF_APPEND`
1473 * :data:`stat.UF_OPAQUE` 1466 * :data:`stat.UF_OPAQUE`
1474 * :data:`stat.UF_NOUNLINK` 1467 * :data:`stat.UF_NOUNLINK`
1475 * :data:`stat.UF_COMPRESSED`
1476 * :data:`stat.UF_HIDDEN`
1477 * :data:`stat.SF_ARCHIVED` 1468 * :data:`stat.SF_ARCHIVED`
1478 * :data:`stat.SF_IMMUTABLE` 1469 * :data:`stat.SF_IMMUTABLE`
1479 * :data:`stat.SF_APPEND` 1470 * :data:`stat.SF_APPEND`
1480 * :data:`stat.SF_NOUNLINK` 1471 * :data:`stat.SF_NOUNLINK`
1481 * :data:`stat.SF_SNAPSHOT` 1472 * :data:`stat.SF_SNAPSHOT`
1482 1473
1483 Availability: Unix. 1474 Availability: Unix.
1484 1475
1485 1476
1486 .. function:: chroot(path) 1477 .. function:: chroot(path)
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 * :attr:`st_birthtime` - time of file creation 1817 * :attr:`st_birthtime` - time of file creation
1827 1818
1828 On Mac OS systems, the following attributes may also be available: 1819 On Mac OS systems, the following attributes may also be available:
1829 1820
1830 * :attr:`st_rsize` 1821 * :attr:`st_rsize`
1831 * :attr:`st_creator` 1822 * :attr:`st_creator`
1832 * :attr:`st_type` 1823 * :attr:`st_type`
1833 1824
1834 .. note:: 1825 .. note::
1835 1826
1836 The exact meaning and resolution of the :attr:`st_atime`, 1827 The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime` , and
1837 :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating 1828 :attr:`st_ctime` members depends on the operating system and the file syst em.
1838 system and the file system. For example, on Windows systems using the FAT 1829 For example, on Windows systems using the FAT or FAT32 file systems,
1839 or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and 1830 :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has only 1- day
1840 :attr:`st_atime` has only 1-day resolution. See your operating system 1831 resolution. See your operating system documentation for details.
1841 documentation for details.
1842 1832
1843 For backward compatibility, the return value of :func:`~os.stat` is also acce ssible 1833 For backward compatibility, the return value of :func:`~os.stat` is also acce ssible
1844 as a tuple of at least 10 integers giving the most important (and portable) 1834 as a tuple of at least 10 integers giving the most important (and portable)
1845 members of the :c:type:`stat` structure, in the order :attr:`st_mode`, 1835 members of the :c:type:`stat` structure, in the order :attr:`st_mode`,
1846 :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:`st_uid`, 1836 :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:`st_uid`,
1847 :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:`st_mtime`, 1837 :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:`st_mtime`,
1848 :attr:`st_ctime`. More items may be added at the end by some implementations. 1838 :attr:`st_ctime`. More items may be added at the end by some implementations.
1849 1839
1850 .. index:: module: stat 1840 .. index:: module: stat
1851 1841
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 have typed on a command line. For the C programmer, this is the ``argv[0]`` 2078 have typed on a command line. For the C programmer, this is the ``argv[0]``
2089 passed to a program's :c:func:`main`. For example, ``os.execv('/bin/echo', 2079 passed to a program's :c:func:`main`. For example, ``os.execv('/bin/echo',
2090 ['foo', 'bar'])`` will only print ``bar`` on standard output; ``foo`` will seem 2080 ['foo', 'bar'])`` will only print ``bar`` on standard output; ``foo`` will seem
2091 to be ignored. 2081 to be ignored.
2092 2082
2093 2083
2094 .. function:: abort() 2084 .. function:: abort()
2095 2085
2096 Generate a :const:`SIGABRT` signal to the current process. On Unix, the defa ult 2086 Generate a :const:`SIGABRT` signal to the current process. On Unix, the defa ult
2097 behavior is to produce a core dump; on Windows, the process immediately retur ns 2087 behavior is to produce a core dump; on Windows, the process immediately retur ns
2098 an exit code of ``3``. Be aware that calling this function will not call the 2088 an exit code of ``3``. Be aware that programs which use :func:`signal.signal `
2099 Python signal handler registered for :const:`SIGABRT` with 2089 to register a handler for :const:`SIGABRT` will behave differently.
2100 :func:`signal.signal`.
2101 2090
2102 Availability: Unix, Windows. 2091 Availability: Unix, Windows.
2103 2092
2104 2093
2105 .. function:: execl(path, arg0, arg1, ...) 2094 .. function:: execl(path, arg0, arg1, ...)
2106 execle(path, arg0, arg1, ..., env) 2095 execle(path, arg0, arg1, ..., env)
2107 execlp(file, arg0, arg1, ...) 2096 execlp(file, arg0, arg1, ...)
2108 execlpe(file, arg0, arg1, ..., env) 2097 execlpe(file, arg0, arg1, ..., env)
2109 execv(path, args) 2098 execv(path, args)
2110 execve(path, args, env) 2099 execve(path, args, env)
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` ar e 2420 As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` ar e
2432 equivalent:: 2421 equivalent::
2433 2422
2434 import os 2423 import os
2435 os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null') 2424 os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')
2436 2425
2437 L = ['cp', 'index.html', '/dev/null'] 2426 L = ['cp', 'index.html', '/dev/null']
2438 os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) 2427 os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)
2439 2428
2440 Availability: Unix, Windows. :func:`spawnlp`, :func:`spawnlpe`, :func:`spawn vp` 2429 Availability: Unix, Windows. :func:`spawnlp`, :func:`spawnlpe`, :func:`spawn vp`
2441 and :func:`spawnvpe` are not available on Windows. :func:`spawnle` and 2430 and :func:`spawnvpe` are not available on Windows.
2442 :func:`spawnve` are not thread-safe on Windows; we advise you to use the
2443 :mod:`subprocess` module instead.
2444 2431
2445 2432
2446 .. data:: P_NOWAIT 2433 .. data:: P_NOWAIT
2447 P_NOWAITO 2434 P_NOWAITO
2448 2435
2449 Possible values for the *mode* parameter to the :func:`spawn\*` family of 2436 Possible values for the *mode* parameter to the :func:`spawn\*` family of
2450 functions. If either of these values is given, the :func:`spawn\*` functions 2437 functions. If either of these values is given, the :func:`spawn\*` functions
2451 will return as soon as the new process has been created, with the process id as 2438 will return as soon as the new process has been created, with the process id as
2452 the return value. 2439 the return value.
2453 2440
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 2873
2887 .. function:: urandom(n) 2874 .. function:: urandom(n)
2888 2875
2889 Return a string of *n* random bytes suitable for cryptographic use. 2876 Return a string of *n* random bytes suitable for cryptographic use.
2890 2877
2891 This function returns random bytes from an OS-specific randomness source. Th e 2878 This function returns random bytes from an OS-specific randomness source. Th e
2892 returned data should be unpredictable enough for cryptographic applications, 2879 returned data should be unpredictable enough for cryptographic applications,
2893 though its exact quality depends on the OS implementation. On a UNIX-like 2880 though its exact quality depends on the OS implementation. On a UNIX-like
2894 system this will query /dev/urandom, and on Windows it will use CryptGenRando m. 2881 system this will query /dev/urandom, and on Windows it will use CryptGenRando m.
2895 If a randomness source is not found, :exc:`NotImplementedError` will be raise d. 2882 If a randomness source is not found, :exc:`NotImplementedError` will be raise d.
OLDNEW
« no previous file with comments | « Doc/library/os.path.rst ('k') | Doc/library/packaging.compiler.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+