If a default value would be acceptable to the application (which is quite likely), then this would be a much cleaner solution.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roland Heiber Sent: 16 December 2004 10:28 To: [EMAIL PROTECTED] Subject: Re: KeyError [EMAIL PROTECTED] wrote: > Hi "R", > > The only explanation I can give is that the environment varialbe REMOTE_ADDR > does not exist! Wrap your high-level code with try and except. Example: > try: > tablesDirectory = tablesDirectoryPrefix + os.environ['REMOTE_ADDR'] > except KeyError: > # Code to handle the fact tht REMOT_ADDR does not exist. ... or just replace os.environ['REMOTE_ADDR'] with os.environ.get('REMOTE_ADDR', 'enter_default_here') to use a default in case of missing REMOTE_ADDR ... HtH, Roland -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list