"?????" <nikos.gr...@gmail.com> wrote in message news:l20utg$278$1...@dont-email.me... > ???? 26/9/2013 12:07 ??, ?/? Antoon Pardon ??????: >> Experiment and find out for yourself. That is the only way you will >> acquire the experience and understanding you need. Sure we could >> spoon feed you the line you need, but that will only result in you >> using that line without any understanding of what you are doing so >> that if in a few months time something goes wrong, you again will >> have no understanding of what goes on and still will have no clue >> on how to handle a problem. > > I have tried code and also provided alternative code to solve my problem > which also doesn't solve it. > > So, you cannot accuse me that i'm not trying, that would be the case to > just ask for a line without trying anything for myself, which i did twice.
Agreed. You did post the work you had already done which seems reasonable to me. For your first example, because you are worried about key errors maybe you could code something like the following. try: city = gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] ) except KeyError: try: city = gi.time_zone_by_addr( os.environ['REMOTE_ADDR'] ) except KeyError: city = "??????? ????" Does that help? James -- https://mail.python.org/mailman/listinfo/python-list