title: TypeError when calling expect method of pexpect module in Python 3
body: <p>I am trying to use pexpect module (version 3.3) with Python 3.4.0. I get an error </p>
  
  <blockquote>
    <p>TypeError: must be str, not bytes</p>
  </blockquote>
  
  <p>when I call child.expect method.</p>
  
  <p>Actual code is standard example from pexpect documentation:</p>
  
  <pre><code>child = pexpect.spawn('ssh foo@bar.com')
  index = child.expect([pexpect.TIMEOUT, pexpect.EOF, ssh_newkey, '.*password:'])
  </code></pre>
  
  <p>Exactly the same code works properly with pexpect module (version 3.1), and Python version 2.7.6.</p>
  
  <p>Pexpect documentation on GitHub states that pexpect version 3.3 requires Python 2.6 or 3.2 or above. Does anybody know if pexpect does not work with Python 3 for some reason despite what is stated in documentation for this module?</p>
  
  <p>This is traceback output that I get:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/sambo9/python/python3-pexpect.py", line 17, in &lt;module&gt;
      main()
    File "/home/sambo9/python/python3-pexpect.py", line 13, in main
      child.expect('.*password:')
    File "/usr/local/lib/python3.4/dist-packages/pexpect/__init__.py", line 1451, in expect
      timeout, searchwindowsize)
    File "/usr/local/lib/python3.4/dist-packages/pexpect/__init__.py", line 1466, in expect_list
      timeout, searchwindowsize)
    File "/usr/local/lib/python3.4/dist-packages/pexpect/__init__.py", line 1535, in expect_loop
      c = self.read_nonblocking(self.maxread, timeout)
    File "/usr/local/lib/python3.4/dist-packages/pexpect/__init__.py", line 985, in read_nonblocking
      self._log(s, 'read')
    File "/usr/local/lib/python3.4/dist-packages/pexpect/__init__.py", line 908, in _log
      second_log.write(s)
    File "/usr/lib/python3.4/idlelib/PyShell.py", line 1339, in write
      raise TypeError('must be str, not ' + type(s).__name__)
  TypeError: must be str, not bytes
  </code></pre>
  
  <p>Additionally, I also see "OpenSSH" box pop open via GUI on Ubuntu prompting for password when I run the script. This does not happen under Python 2.7.6. In Python 2.7, I can login into system without any manual interaction - everything happens automatically via script. </p>