KeyError

Doran_Dermot at emc.com Doran_Dermot at emc.com
Wed Dec 15 08:43:57 EST 2004


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. 

Hope that this helps and is not just another infamous "Dermot Didn't Get It"
posting!

Cheers!!

-----Original Message-----
From: python-list-bounces+doran_dermot=emc.com at python.org
[mailto:python-list-bounces+doran_dermot=emc.com at python.org] On Behalf Of
rootshell at gazeta.pl
Sent: 15 December 2004 13:34
To: python-list at python.org
Subject: KeyError

Hello.
Maybe someone will help me with this KeyError:

............................
Traceback (most recent call last):
  File "C:\Python\tabla.py", line 929, in -toplevel-
    tablesDirectory = tablesDirectoryPrefix + os.environ['REMOTE_ADDR']
  File "C:\Python23\lib\os.py", line 417, in __getitem__
    return self.data[key.upper()]
KeyError: 'REMOTE_ADDR'
.......................... 


Thanks for reading this.
R.



-- 
http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list