summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2014-08-08 13:29:49 -0700
committerThomas Kluyver <takowl@gmail.com>2014-08-08 13:29:49 -0700
commit8d96042177a6986ae5b117e31916638309b2fd03 (patch)
treeb21ba4f87570b8f3dc7664d691019ab65c62a85f
parent3c9644f1cd6af755517e730b8e712e3026b4628c (diff)
parent96d2b49c8b46a6da85e58da8fbd6f7e6fd192eb7 (diff)
downloadpexpect-8d96042177a6986ae5b117e31916638309b2fd03.tar.gz
Merge pull request #101 from BrianOn99/py3docstring
update documentation string in pexpect/__init__.py to be compatible with...
-rw-r--r--pexpect/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pexpect/__init__.py b/pexpect/__init__.py
index cace43b..4a34f15 100644
--- a/pexpect/__init__.py
+++ b/pexpect/__init__.py
@@ -365,14 +365,19 @@ class spawn(object):
Example log input and output to a file::
child = pexpect.spawn('some_command')
- fout = file('mylog.txt','w')
+ fout = open('mylog.txt','wb')
child.logfile = fout
Example log to stdout::
+ # In Python 2:
child = pexpect.spawn('some_command')
child.logfile = sys.stdout
+ # In Python 3, spawnu should be used to give str to stdout:
+ child = pexpect.spawnu('some_command')
+ child.logfile = sys.stdout
+
The logfile_read and logfile_send members can be used to separately log
the input from the child and output sent to the child. Sometimes you
don't want to see everything you write to the child. You only want to
@@ -380,10 +385,13 @@ class spawn(object):
child = pexpect.spawn('some_command')
child.logfile_read = sys.stdout
+
+ Remember to use spawnu instead of spawn for the above code if you are
+ using Python 3.
To separately log output sent to the child use logfile_send::
- self.logfile_send = fout
+ child.logfile_send = fout
If ``ignore_sighup`` is True, the child process will ignore SIGHUP
signals. For now, the default is True, to preserve the behaviour of