diff options
author | R. David Murray <rdmurray@bitdance.com> | 2009-06-25 17:40:52 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2009-06-25 17:40:52 (GMT) |
commit | 9f8a51c3263eab6701b477b7f46de783320ba3d2 (patch) | |
tree | 2925bd3c780210b6fa5bc40dc1d36fd0a7d01f09 /Doc | |
parent | 8f089854227c17c786412f93c6d325d553eeaca1 (diff) | |
download | cpython-9f8a51c3263eab6701b477b7f46de783320ba3d2.zip cpython-9f8a51c3263eab6701b477b7f46de783320ba3d2.tar.gz cpython-9f8a51c3263eab6701b477b7f46de783320ba3d2.tar.bz2 |
Merged revisions 73026,73313,73511,73554 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73026 | r.david.murray | 2009-05-29 15:30:27 -0400 (Fri, 29 May 2009) | 3 lines
Issue 6141: document that the first item of args is still the
command name even when executable is specified.
........
r73313 | r.david.murray | 2009-06-08 20:44:22 -0400 (Mon, 08 Jun 2009) | 4 lines
Issue 2947: document how return code handling translates from
os.popen to subprocess. Also fixes reference link in the
os.spawn documentation.
........
r73511 | r.david.murray | 2009-06-22 18:11:04 -0400 (Mon, 22 Jun 2009) | 2 lines
Improve English phrasing.
........
r73554 | r.david.murray | 2009-06-25 10:21:06 -0400 (Thu, 25 Jun 2009) | 2 lines
Add a couple of missing function alias declarations to the turtle docs.
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/functions.rst | 2 | ||||
-rw-r--r-- | Doc/library/os.rst | 4 | ||||
-rw-r--r-- | Doc/library/subprocess.rst | 39 | ||||
-rw-r--r-- | Doc/library/turtle.rst | 2 |
4 files changed, 33 insertions, 14 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 9764eae..cb00cf2 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -151,7 +151,7 @@ available. They are listed here in alphabetical order. ``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if it consists of a single expression, or ``'single'`` if it consists of a single interactive statement (in the latter case, expression statements that - evaluate to something else than ``None`` will be printed). + evaluate to something other than ``None`` will be printed). The optional arguments *flags* and *dont_inherit* control which future statements (see :pep:`236`) affect the compilation of *source*. If neither diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 357b37e..2b5afc0 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1710,8 +1710,8 @@ written in Python, such as a mail server's external command delivery program. (Note that the :mod:`subprocess` module provides more powerful facilities for spawning new processes and retrieving their results; using that module is - preferable to using these functions. Check specially the *Replacing Older - Functions with the subprocess Module* section in that documentation page.) + preferable to using these functions. Check especially the + :ref:`subprocess-replacements` section.) If *mode* is :const:`P_NOWAIT`, this function returns the process id of the new process; if *mode* is :const:`P_WAIT`, returns the process's exit code if it diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index efac7e6..2bc8f74 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -39,9 +39,12 @@ This module defines one class called :class:`Popen`: Arguments are: *args* should be a string, or a sequence of program arguments. The program - to execute is normally the first item in the args sequence or the string if a - string is given, but can be explicitly set by using the *executable* - argument. + to execute is normally the first item in the args sequence or the string if + a string is given, but can be explicitly set by using the *executable* + argument. When *executable* is given, the first item in the args sequence + is still treated by most programs as the command name, which can then be + different from the actual executable name. On Unix, it becomes the display + name for the executing program in utilities such as :program:`ps`. On Unix, with *shell=False* (default): In this case, the Popen class uses :meth:`os.execvp` to execute the child program. *args* should normally be a @@ -354,8 +357,8 @@ Replacing shell pipeline output = p2.communicate()[0] -Replacing os.system() -^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.system` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -382,8 +385,8 @@ A more realistic example would look like this:: print >>sys.stderr, "Execution failed:", e -Replacing the os.spawn family -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing the :func:`os.spawn <os.spawnl>` family +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P_NOWAIT example:: @@ -410,8 +413,8 @@ Environment example:: Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) -Replacing os.popen, os.popen2, os.popen3 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -453,9 +456,23 @@ Replacing os.popen, os.popen2, os.popen3 stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) +Return code handling translates as follows:: + + pipe = os.popen(cmd, 'w') + ... + rc = pipe.close() + if rc != None and rc % 256: + print "There were some errors" + ==> + process = Popen(cmd, 'w', stdin=PIPE) + ... + process.stdin.close() + if process.wait() != 0: + print "There were some errors" + -Replacing functions from the popen2 module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing functions from the :mod:`popen2` module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. note:: diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 0735dbc..da38c1d 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -1140,6 +1140,7 @@ Appearance .. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None) + turtlesize(stretch_wid=None, stretch_len=None, outline=None) :param stretch_wid: positive number :param stretch_len: positive number @@ -1332,6 +1333,7 @@ Special Turtle methods .. function:: getturtle() + getpen() Return the Turtle object itself. Only reasonable use: as a function to return the "anonymous turtle": |