title: Python popen() - communicate( str.encode(encoding="utf-8", errors="ignore") ) crashes
body: <p>Using Python 3.4.3 on Windows.</p>
  
  <p>My script runs a little java program in console, and should get the ouput:</p>
  
  <pre><code>import subprocess
  p1 = subprocess.Popen([ ... ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
  out, err = p1.communicate(str.encode("utf-8"))
  </code></pre>
  
  <p>This leads to a normal </p>
  
  <blockquote>
    <p>'UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 135: character maps to &lt; undefined>'.</p>
  </blockquote>
  
  <p>Now I want to ignore errors:</p>
  
  <pre><code>out, err = p1.communicate(str.encode(encoding="utf-8", errors="ignore"))
  </code></pre>
  
  <p>This leads to a more interesting error I found no help for using google:</p>
  
  <blockquote>
    <p>TypeError: descriptor 'encode' of 'str' object needs an argument</p>
  </blockquote>
  
  <p>So it seems that python does not even know anymore what the arguments for str.encode(...) are. The same also applies when you leave out the errors part.</p>