Minor problems with python
EAS
eriksp at attbi.nospam.com
Sat Jun 5 12:56:21 EDT 2004
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:
>>> =========================== RESTART ============================
>>>
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
More information about the Python-list
mailing list