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

Νίκος Gr33k nikos at superhost.gr
Fri Jul 5 12:33:05 CEST 2013


Στις 5/7/2013 12:21 μμ, ο/η Dave Angel έγραψε:
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "/usr/local/lib/python3.3/os.py", line 669, in __getitem__
>      value = self._data[self.encodekey(key)]
> KeyError: b'REMOTE_ADDR


Wait!
Are you saying that the ip address is being returned as a byte string 
which then i have to decode with something like:

host = socket.gethostbyaddr( os.environ['REMOTE_HOST'].decode('utf-8') )[0]

?

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



More information about the Python-list mailing list