tags:

views:

48

answers:

2

Possible Duplicate:
Python Application does nothing

#Dash Shell
import os
import datetime

class LocalComputer:
    pass

def InitInformation():
    Home = LocalComputer()
    #Acquires user information
    if (os.name == "nt"):
        Home.ComputerName = os.getenv("COMPUTERNAME")
        Home.Username = os.getenv("USERNAME")
        Home.Homedir = os.getenv("HOMEPATH")
    else:
        Home.ComputerName = os.getenv("HOSTNAME")
        Home.Username = os.getenv("USER")
        Home.Homedir = os.getenv("HOME")
    return Home

def MainShellLoop():
    print ("--- Dash Shell ---")
    Home = InitInformation()
    userinput = None
    currentdir = Home.Homedir
    while (userinput != "exit"):
        rightnow = datetime.datetime.now()
        try:
            userinput = input(str(Home.ComputerName) + "\\" + str(Home.Username) + ":" + str(rightnow.month) + "/" + str(rightnow.day) + "/" + str(rightnow.year) + "@" + str(currentdir))
        except:
            print("Invalid Command specified, please try again")

MainShellLoop()

The input() is supposed to execute and it stopped working after changing something I dont remember

It's coded under Python 3.1.2 with Windows 7, I know the Unix Hostname global variable is wrong

I know userinput does nothing, I want to get this part working before I continue on

Thanks

It outputs nothing

+1  A: 

You define a class and two functions, but you don't seem to call any of them anywhere. Are you missing a call to MainShellLoop() in the end?

sth
I called that in the actual code just forgot to copy and paste that in, no result and I called it in the main part of the main (not function main but at the top-level
Indebi
@Indebi: Show us the call.
Fred Larson
I edited it and added it and it still does nothing
Indebi
A: 

I think you need a call to MainShellLoop.

Fred Larson
I called that in the actual code just forgot to copy and paste that in, no result and I called it in the main part of the main (not function main but at the top-level
Indebi