It works for me as you would expect I guess.
(base) tzane:~/python_test$ python test_1.py
whereis ls
exit
(b'ls: /bin/ls /usr/share/man/man1/ls.1.gz\n', b'')
(base) tzane:~/python_test$
You are not getting any output if you are not telling bash to output anything. Calling .wait() with pipes can cause deadlocks so I would do something like this instead
import subprocess
p = subprocess.Popen("/bin/bash", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
print(p.communicate(timeout=30))
except TimeoutExpired:
p.kill()
print(p.commnunicate())
as suggested in the documentation or just use subprocess.run if you don't have to interact with the subprocess and you just want to catch the output.