Νίκος Gr33k <ni...@superhost.gr> writes:

> try:
>       host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
> except Exception as e:
>       host = "Reverse DNS Failed"
>
> How can the above code not be able to reeverse dns any more and it
> falls back to  the failed string?

The only way to know is actually printing out the exception, either to
stderr, or better using the logging facility, as I suggested.

FYI, your code above is (almost) exactly equivalent to the simpler

    try:
        host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
    except:
        host = "Reverse DNS Failed"

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  |                 -- Fortunato Depero, 1929.

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

Reply via email to