UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte
Dave Angel
davea at davea.name
Sun Sep 29 07:11:23 EDT 2013
On 29/9/2013 06:24, Νίκος wrote:
<snip>
>
> except Exception as e: ===> except socket.gaierror as e:
> which cannot handle unicore realted errors and the exact same error
> appeared with my ip address involved at the error log.
>
> so, the question that arises again and reamins is how come 'host' vars
> gets a values most of the times and sometimes it just outputs back
> unicode related erros.
>
> I must tell you that i had this problem also months ago, but since i
> couldnt able to solve it i left it as it was, but it just started to
> make things more and more hectic.
>
it would be interesting to see a more complete stack trace. But I'd
guess that in the process of looking up the ip address at the dns
servers, somebody is producing a non-ascii byte string that isn't
encoded in utf-8. It might conceivably be in your /etc/hosts file as
well, assuming gethostbyname() looks there when the internet query
fails.
--
DaveA
More information about the Python-list
mailing list