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

Νίκος nikos.gr33k at gmail.com
Sun Sep 29 04:37:14 EDT 2013


Στις 29/9/2013 11:30 πμ, ο/η Νίκος έγραψε:
> Στις 29/9/2013 11:23 πμ, ο/η Chris Angelico έγραψε:
>> On Sun, Sep 29, 2013 at 6:19 PM, Νίκος <nikos.gr33k at gmail.com> wrote:
>>> ipval is suposed to get just an ip address.
>>> ip addresses doesnt change its just number seperated by dots.
>>
>> That's one way an IP address can be rendered. It's not the only one.
>> There's an entire category of IP addresses that's usually written with
>> colons rather than dots. However, I reiterate: How do you KNOW what's
>> in ipval? I wonder if there's an easy way for you to find out...
>>
>> ChrisA
>>
> yes it is, i take it you mean to just print the damn varibale to see
> what on eath is actually outputs back....


Here, as exactly as i though of it:

print( ipval )  returned  46.198.177.249

just a noirmal IPv4 ip address.

which leaved the questions of:

[Sun Sep 29 07:44:43 2013] [error] [client 173.245.49.126] Traceback 
(most recent call last):
[Sun Sep 29 07:44:43 2013] [error] [client 173.245.49.126]   File 
"/home/nikos/public_html/cgi-bin/metrites.py", line 30, in <module>
[Sun Sep 29 07:44:43 2013] [error] [client 173.245.49.126]     host = 
socket.gethostbyaddr( ipval ) [0]
[Sun Sep 29 07:44:43 2013] [error] [client 173.245.49.126] 
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: 
invalid start byte
[Sun Sep 29 07:44:43 2013] [error] [client 173.245.49.126] Premature end 
of script headers: metrites.py


What on earth it cant decode?



More information about the Python-list mailing list