I am creating this whole thing in Python, and the problem is quite complicated. I'm using Linux. Say I run the following code:
- Code: Select all
from subprocess import *
p = Popen("python", shell="my-shell.py")
This works PERFECTLY, the "my-shell.py" script seems to run as the shell for "python", but the problem is, I don't know how to create my-shell.py to receive commands from "python" and send responses through e.g. stdout.
I guess that when the program calls os.popen(), the second object, "stdout" would be sys.stdout from the my-shell.py script. If i'm wrong, correct me. But how do you receive those command, and if the shell can't recognise them, how do you send them to the default "bash" and send the reply from bash to the program?
EDIT: another problem:
- Code: Select all
from subprocess import *
p = Popen("python hello.py")
Even if "hello.py" exists, it gives an error, saying it can't find some file... Why is that?