UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

Νίκος Gr33k nikos at superhost.gr
Fri Jul 5 04:00:21 EDT 2013


Στις 5/7/2013 10:50 πμ, ο/η Dave Angel έγραψε:
>
> The line started as:
>
>  >      host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
>
> refactor that to:
>         remadd = os.environ('REMOVE_ADDR')
>         tuple3 = socket.gethostbyaddr(remadd)
>         host = tuple3[0]
>
> and see which one throws the exception.  Then once you have that,
> examine the exact parameters that might be triggering the problem.  In
> particular, figure out the exact types and values for remadd and tuple3.
>
>         print(type(remadd) + " : " + repr(remadd))

I'am not sure how iam supposed to write this: i just tried this:


try:
	remadd = os.environ('REMOVE_ADDR')
	tuple3 = socket.gethostbyaddr(remadd)
	host = tuple3[0]
except:
	host = type(remadd) + " : " + repr(remadd)


but iam getting an internal server error.

I didnt print it as you said but its the same thing host var gets 
printed later on.

Now, why would this give an internal server error?

-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list