KeyError
Roland Heiber
roland.heiber at web.de
Thu Dec 16 05:27:57 EST 2004
Doran_Dermot at emc.com 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
More information about the Python-list
mailing list