#!/usr/bin/python import readline import threading import time import GlobalVariables class InputShell(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run (self): outputShell= OutputShell() OutputShell.start(outputShell) while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"): dummy=raw_input("SHELL>>> ") if(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"): GlobalVariables.counter +=1 GlobalVariables.counter%=10 GlobalVariables.UserInput = str(GlobalVariables.counter)+dummy else: break time.sleep(0.7) print "EXITING INPUTSHELL... press to exit" class OutputShell(threading.Thread): lastvar='' def run (self): while(GlobalVariables.UserInput!="exit" and GlobalVariables.UserInput != "EXIT"): time.sleep(0.001) if(GlobalVariables.ServerMessage!=self.lastvar): #print "\n(SHELL) You entered:",GlobalVariables.ServerMessage #sys.stdout.write( "SHELL2 >>>") print GlobalVariables.ServerMessage self.lastvar=GlobalVariables.ServerMessage print "EXITING OUTPUTSHELL...press to exit " #sys.exit(0)