Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

In thisthis 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()[0]
        print output
    except Exception:
        print "Something went wrong."

Why is this?

EDIT

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.

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()[0]
        print output
    except Exception:
        print "Something went wrong."

Why is this?

EDIT

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.

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()[0]
        print output
    except Exception:
        print "Something went wrong."

Why is this?

EDIT

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.

changed title to "within idle", not "in startx" (which doesn't make sense)
Link

Why does Python program work in console mode, but not in Startxwithin IDLE?

Tweeted twitter.com/#!/StackRaspi/status/318949704153063427
added 319 characters in body
Source Link
xxmbabanexx
  • 3.3k
  • 7
  • 35
  • 56

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()[0]
        print output
    except Exception:
        print "Something went wrong."

Why is this?

EDIT

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.

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()[0]
        print output
    except Exception:
        print "Something went wrong."

Why is this?

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()[0]
        print output
    except Exception:
        print "Something went wrong."

Why is this?

EDIT

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.

Source Link
xxmbabanexx
  • 3.3k
  • 7
  • 35
  • 56
Loading