my 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)
perfect work in interpreter , but if i use : python3 myscript , i have this error :
a=str(p.stdout.read().decode('utf-8'))
AttributeError: 'NoneType' object has no attribute 'decode'
Why ? Thanks alot