Newbie Needs Help -- Name and Key errors
Bob Langdon
bingdo19 at earthlink.net
Tue Apr 25 12:06:54 EDT 2000
Hi,
New to Python, and moving a site for a client. The backend sas developed
by another developer in Python. I've i9nstalled Python1.5.2 in my home
direcpory and tested it. The interpreter seems to functioning properly.
However, some paths seem to be defined incorrectly.
When running a script "getresume.py" for example,
>>try:
import sys
sys.stderr = sys.stdout
sys.path.insert(0,'.')
sys.path.append('/usr/local/lib/python1.5')
sys.path.append('/usr/local/lib/python1.5/site-packages')
import os
TEMPLATES=os.environ['DOCUMENT_ROOT']
from calendar import month_name
from types import *
from formhandler import FormHandler
from string import strip, split, join, atol, atof, upper, lower,
capitalize
from refer import getReferer, addGetResume
from time import asctime, localtime, time, strftime
from urllib import quote_plus, unquote_plus
from fcsetup import LOCALHOSTNAME
from fcsetup import *
import Mail
except:
print '<pre>\n'
import traceback
traceback.print_exc()
print sys.path
resumeDIR = DEPOT
class GetResumeHandler(FormHandler):
yada yafda yada...<<
I get the following errors:
Traceback (innermost last):
File "./getresume.py", line 10, in ?
TEMPLATES=os.environ['DOCUMENT_ROOT']
File "/home/fcinc/python/Python-1.5.2/lib/python1.5/UserDict.py", line
14, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: DOCUMENT_ROOT
['.', '.', '/home/fcinc/python/Python-1.5.2/lib/python1.5/',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/plat-linux2',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/lib-tk',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/lib-dynload',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/Gadfly',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/HTMLgen',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/MySQL',
'/home/fcinc/python/Python-1.5.2/lib/python1.5/site-packages/kwParsing',
'/home/fcinc/python/Python-1.5.2',
'/home/fcinc/python/Python-1.5.2/lib/Python1.5/site-packages']
Traceback (innermost last):
File "./getresume.py", line 28, in ?
resumeDIR = DEPOT
NameError: DEPOT
I think DEPOT might be a reference to the MySQL database, using the
Berkley dbmodule (which I can't find). I certainly can't find a
directory named DEPOT anywhere on the old host's server.
Neither can I fathom where "DOCUMENT_ROOT" is defined, or find a file
called "os.environ."
Please help!
TIA,
More information about the Python-list
mailing list