title: Why decode only work in python interpreter?
body: <p>my code : </p>
  
  <pre><code>import fcntl, os
  import subprocess
  p = subprocess.Popen(['bash'], bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  fcntl.fcntl(p.stdout.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
  p.stdin.write( b'ls -l' + b'\n')
  a=str(p.stdout.read().decode('utf-8'))
  print(a)
  </code></pre>
  
  <p>perfect work in interpreter , but if i use : python3 myscript , i have this error : </p>
  
  <pre><code>a=str(p.stdout.read().decode('utf-8'))
  AttributeError: 'NoneType' object has no attribute 'decode'
  </code></pre>
  
  <p>Why ?
  Thanks alot</p>