summaryrefslogtreecommitdiff
path: root/examples/ftp.py
diff options
context:
space:
mode:
authorSteven Myint <git@stevenmyint.com>2013-10-08 19:46:16 -0700
committerSteven Myint <git@stevenmyint.com>2013-10-08 19:46:16 -0700
commita34cfbdde75d8d0aa276afeeb824522fe82a7b34 (patch)
treee1d41ea40131dcc927906b67cdcf4cbc6a156688 /examples/ftp.py
parent1141915a17bd446d330de0c8fe3a017ebc6b2e06 (diff)
downloadpexpect-a34cfbdde75d8d0aa276afeeb824522fe82a7b34.tar.gz
Add note about unicode_literals and spawnu
Diffstat (limited to 'examples/ftp.py')
-rwxr-xr-xexamples/ftp.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/ftp.py b/examples/ftp.py
index 678d032..a1c1343 100755
--- a/examples/ftp.py
+++ b/examples/ftp.py
@@ -31,7 +31,11 @@ from __future__ import unicode_literals
import pexpect
import sys
+# Note that, for Python 3 compatibility reasons, we are using spawnu and
+# importing unicode_literals (above). spawnu accepts Unicode input and
+# unicode_literals makes all string literals in this script Unicode by default.
child = pexpect.spawnu('ftp ftp.openbsd.org')
+
child.expect('(?i)name .*: ')
child.sendline('anonymous')
child.expect('(?i)password')