UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte
Wayne Werner
wayne at waynewerner.com
Fri Jul 12 07:47:53 EDT 2013
On Thu, 4 Jul 2013, Νίκος Γκρ33κ wrote:
> Στις 4/7/2013 6:10 μμ, ο/η MRAB έγραψε:
>> What do you mean "I don't know how to catch the exception with
>> OSError"? You've tried "except socket.gaierror" and "except
>> socket.herror", well just write "except OSError" instead!
>
>
> try:
> host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
> except OSError:
> host = "UnResolved"
>
> produces also an internal server error.
>
> Are you sure is just except OSError ?
>
Have you ensured that 'REMOTE_ADDR' is actually a key in os.environ? I
highly recommend using the logging module to help diagnose what the actual
exception is.
HTH,
-W
More information about the Python-list
mailing list