In this Stack Overflow question I asked about creating a Python program of mine which was meant to allow me to access the terminal from a Python shell. It did not work... at least when running the program through
startx. But, interestingly enough, when I ran it through
ssh (my Pi was running in console mode) the program ran like a charm. The code is below:
import subprocess import socket import sys import platform import os print "WELCOME TO xTROL. \n" pyVER = sys.version OS = platform.system() print pyVER, "\n" print "Running on %s" % (OS) while True: INPUT = raw_input(">>>") cmd_FORMAT = INPUT.split() try: output = subprocess.Popen(cmd_FORMAT, stdout=subprocess.PIPE).communicate() print output except Exception: print "Something went wrong."
Why is this?
By did not work, I mean that the program did not work interactively. Writing
Python in the
startx version would return a blank line, in console mode I entered the interactive prompt.
I ran the
startx Python program by double clicking on the item, opening idle, and then executing the program.