Minor problems with python

E

EAS

Whenever I open a python program using a normal console window, it says:
'import site' failed; use -v for traceback
What does this mean and how can I get rid of it?

Also, I have this one program that won't stay open at all; when I into IDLE
and run it there to see what the problem is, it just says:then it starts the program. How do I fix this? Here's the code for it if
needed:

###############################################################
# Python Command Prompt - by Gecko_LoL, 6/5/2004. Version 1.0 #
###############################################################

from os import chdir, startfile, getcwd, listdir, \
remove, rmdir, mkdir, rename, system

command = ""
error = ".error."
print ("\tPython Command Prompt\n")

while command != "q":
try:
command = raw_input(">>> ")
if command.lower() == "cd":
dir = raw_input("... ")
chdir(dir)
elif command.lower() == "st":
file = raw_input("... ")
startfile(file)
elif command.lower() == "dir":
dir = getcwd()
print dir, "\n"
elif command.lower() == "li":
for item in listdir("."):
print item
print
elif command.lower() == "linum":
start = input("... ")
end = input("... ")
for item in listdir(".")[start:end]:
print item
print
elif command.lower() == "del":
file = raw_input("... ")
remove(file)
elif command.lower() == "rd":
dir = raw_input("... ")
rmdir(dir)
elif command.lower() == "md":
dir = raw_input("... ")
mkdir(dir)
elif command.lower() == "ren":
old = raw_input("... ")
new = raw_input("... ")
rename(old, new)
elif command.lower() == "com":
com = raw_input("... ")
system(com)
else:
if command == "q":
break
print error
continue
except:
print error
continue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top