Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49836
| From | Dave Angel <davea@davea.name> |
|---|---|
| Subject | Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte |
| Date | 2013-07-04 06:29 -0400 |
| References | <kr3c7k$tjs$2@news.grnet.gr> <mailman.4214.1372931978.3114.python-list@python.org> <kr3hab$jn0$1@news.grnet.gr> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4216.1372933781.3114.python-list@python.org> (permalink) |
On 07/04/2013 06:03 AM, Νίκος wrote: > Στις 4/7/2013 12:59 μμ, ο/η Dave Angel έγραψε: >> 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. > > Ima using Python v3.3.2 Dave > > The host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or > 'UnResolved' should not have give an error since i explicityl tell it > that if it cannot resolve dns the ip to hostname to set it as "unresolved" That's not true. The 'or' doesn't get executed until after the gethostbyaddr() call has returned. So if something's wrong with that call, and it throws an exception, the 'or "unresolved"' won't help. I don't know that this is the problem, and I'm not all familiar with these api's. But I cannot see anything else that could go wrong there to give that particular exception. Unless the hostname it's going to return is a byte string. > > The error appear ONLY when i CloudFlare superhost.gr > > If i pause tthe domain form CloudFlare then my website loads properly. > > I don't really know what CloudFlare is, and have no idea what 'pausing the form' will do. But since it has something to do with dns, perhaps it's returning an invalid host name, one that isn't encoded in utf-8. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 11:37 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-04 05:59 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 13:03 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-04 06:29 -0400
Fwd: Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 13:36 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-07-04 11:50 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 13:38 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Chris Angelico <rosuav@gmail.com> - 2013-07-04 20:54 +1000
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 14:29 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte MRAB <python@mrabarnett.plus.com> - 2013-07-04 12:52 +0100
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 15:06 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Chris Angelico <rosuav@gmail.com> - 2013-07-04 22:37 +1000
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte MRAB <python@mrabarnett.plus.com> - 2013-07-04 12:06 +0100
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 14:36 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte MRAB <python@mrabarnett.plus.com> - 2013-07-04 13:07 +0100
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 15:47 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte MRAB <python@mrabarnett.plus.com> - 2013-07-04 14:34 +0100
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Γκρ33κ <nikos@superhost.gr> - 2013-07-04 16:38 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte MRAB <python@mrabarnett.plus.com> - 2013-07-04 16:10 +0100
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Γκρ33κ <nikos@superhost.gr> - 2013-07-04 18:56 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Wayne Werner <wayne@waynewerner.com> - 2013-07-12 06:47 -0500
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Ferrous Cranus <nikos@superhost.gr> - 2013-07-12 14:56 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-12 11:46 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος <nikos@superhost.gr> - 2013-07-04 15:52 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte MRAB <python@mrabarnett.plus.com> - 2013-07-04 14:34 +0100
Fwd: Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Γκρ33κ <nikos@superhost.gr> - 2013-07-04 17:48 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-07-04 15:07 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Γκρ33κ <nikos@superhost.gr> - 2013-07-04 16:26 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-07-04 16:08 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Ferrous Cranus <nikos@superhost.gr> - 2013-07-04 23:25 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-04 22:44 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Michael Torrie <torriem@gmail.com> - 2013-07-04 14:53 -0600
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Nobody <nobody@nowhere.com> - 2013-07-05 01:06 +0100
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Ferrous Cranus <nikos@superhost.gr> - 2013-07-05 09:07 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 08:55 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 10:10 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 09:51 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 09:06 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 10:13 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-05 04:27 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 12:01 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-07-05 00:21 -0700
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-05 03:50 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 11:00 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-05 04:35 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 11:49 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-05 05:21 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 12:25 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 12:24 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 13:28 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 13:26 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 12:36 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 13:42 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 12:59 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 14:05 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 14:16 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 13:16 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 14:27 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte feedthetroll@gmx.de - 2013-07-05 05:06 -0700
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 13:33 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte feedthetroll@gmx.de - 2013-07-05 04:56 -0700
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte feedthetroll@gmx.de - 2013-07-05 05:14 -0700
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Dave Angel <davea@davea.name> - 2013-07-05 09:05 -0400
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 16:11 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Νίκος Gr33k <nikos@superhost.gr> - 2013-07-05 17:27 +0300
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte feedthetroll@gmx.de - 2013-07-05 01:44 -0700
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Lele Gaifax <lele@metapensiero.it> - 2013-07-05 12:16 +0200
Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte roggero.n@gmail.com - 2013-09-06 16:17 -0700
csiph-web