Στις 29/9/2013 11:07 πμ, ο/η Chris Angelico έγραψε:
On Sun, Sep 29, 2013 at 6:04 PM, Νίκος <nikos.gr...@gmail.com> wrote:
How come all these daysthe followinf line work as expected:


host = socket.gethostbyaddr( ipval ) [0]

and only just today just happened to output:

Maybe the ipval is different. Maybe something else is causing the
error. I wonder how, in Python, you would find out which one it is?
Wouldn't it be nice if Python had a function - statement in Python 2 -
that told you what something was.

The snippet is this:

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 Exception as e:
print( "metrites.py => (%s): " % lastvisit, repr( sys.exc_info() ), file=open('/tmp/err.out', 'w') )


ipval is suposed to get just an ip address.
ip addresses doesnt change its just number seperated by dots.
the same provider i uses yesterday i continue to use today, i just restrated the router and got a new ip address and after the new address got assignes to me.

unicode decore error related to host started to happen.
Can someone explain this or have a way to troubleshoot it because this error is bugging me for several months now but not all the time just in cases liek miens today.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to