<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-ligatures:standard;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-ligatures:standard;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-GB>Hi All<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>I’m new to python (4 days </span><span lang=EN-GB style='font-family:Wingdings'>J</span><span lang=EN-GB>) and was wondering if anyone out there can help me<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>I am trying to get the time zones for latitude and longitude  coordinates but am having a few problems<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>The mistakes are probably very basic<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>I have a table in a database with around 600 rows. Each row contains a lat long coordinate for somewhere in the world<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>I want to feed these co-ordinates into a function and then retrieve the time zone. The aim being to convert events which have a local time stamp within each of these 600 places into UTC time<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>I found a piece of code [http://blog.pamelafox.org/2012/04/converting-addresses-to-timezones-in.html] which uses the function [https://gist.github.com/pamelafox/2288222]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>When I try to run the code, I get the error geonames is not defined (This is the function previously linked to)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>I have applied for an account with geonames, I think I have just saved the function file in the wrong directory or something simple. Can anyone help<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>#-------------------------------------------------------------------------------<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB># Converts latitude longitude into a time zone<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB># REF: https://gist.github.com/pamelafox/2288222<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB># REF: http://blog.pamelafox.org/2012/04/converting-addresses-to-timezones-in.html<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>#-------------------------------------------------------------------------------<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>geonames_client = geonames.GeonamesClient('Username_alpha')<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>geonames_result = geonames_client.find_timezone({'lat': 48.871236, 'lng': 2.77928})<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>user.timezone = geonames_result['timezoneId']<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>Thanks<o:p></o:p></span></p></div></body></html>