Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Îίκος, post: 5117965"] Hello although my code is correct just today i saw this in the error_log [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 Which should never had happened since i use the following code: ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) city = "Άγνωστη Πόλη" host = "Άγνωστη Î ÏοÎλευση" try: gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat') city = gi.time_zone_by_addr( ipval ) host = socket.gethostbyaddr( ipval ) [0] except socket.gaierror as e: print( "metrites.py => (%s): " % lastvisit, repr( sys.exc_info() ), file=open('/tmp/err.out', 'w') ) So vene if somethign might have gone wrong with the 'host' assignment, 'host' should have defaulted to "Άγνωστη Î ÏοÎλευση" why the utf-8 error? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position
Top