On 07/04/2013 04:37 AM, Νίκος wrote:
I just started to have this error without changing nothing
in my index.html(template) and metrites.py(which ipen the template)
[Thu Jul 04 11:35:14 2013] [error] [client 108.162.229.97] Original
exception was: [Thu Jul 04 11:35:14 2013] [error] [client
108.162.229.97] Traceback (most recent call last): [Thu Jul 04
11:35:14 2013] [error] [client 108.162.229.97] File
"/home/nikos/public_html/cgi-bin/metrites.py", line 19, in <module>
[Thu Jul 04 11:35:14 2013] [error] [client 108.162.229.97] host =
socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or
'UnResolved' [Thu Jul 04 11:35:14 2013] [error] [client
108.162.229.97] UnicodeDecodeError: 'utf-8' codec can't decode byte
0xb6 in position 0: invalid start byte [Thu Jul 04 11:35:14 2013]
[error] [client 108.162.229.97] Premature end of script headers:
metrites.py
Why cant it decode the starting byte? what starting byte is that?
The error message means that somebody is trying to decode a byte string
into Unicode, and using the utf-8 codec for it. Only certain sequences
are legal in utf-8, and the first byte of a character may not be 0xb6.
So it gives an error. The question is where does this string come from.
Well, the message shows the source line from metrites.py:
host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or 'UnResolved'
So the most likely candidate is the string in the environment named
"REMOTE_ADDR" Can you display that string? it should look like
"11.24.32.4"
or some other valid IP address.
I'm assuming Python 2.7. You should specify the python version when
starting a new thread, as we (or at least I) cannot keep track of what
version everyone's running.
--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list