omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Location & Crash

    Pythonista
    2
    4
    1761
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dann239
      Dann239 last edited by

      https://gist.github.com/PyDann/15f1a5d71254c7efe827

      I want to continually display the current information. What am I missing here?

      Second. (Unrelated to the code on GitHub) The reverse geocode returns a dictionary. I can't pull out a key. When ask to get 'Thoroughfare' it returns None. The dict displays "u 'Thoroughfare':" how do I ask for that?

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        For the github question, you just need to wait a second for the GPS hardware to warm up...

        import time
        
        def start():
            time.sleep(1)
        

        If you leave the GPS hardware on all the time like this, your battery will run down fast. See the comments on your gist for a better way to go.

        1 Reply Last reply Reply Quote 0
        • ccc
          ccc last edited by

          For your second question, location.reverse_geocode() does not return a dictionary but instead returns a list of dictionaries.

          To extract the first dictionary from that list, you can change location.reverse_geocode(loc) to location.reverse_geocode(loc)[0] and then you can get at Thoroughfare in the usual way...

              street = location.reverse_geocode(loc))[0]['Thoroughfare'])
          

          The only downside of this approach is that an exception will be thrown if location.reverse_geocode() returns None or [].

          1 Reply Last reply Reply Quote 0
          • Dann239
            Dann239 last edited by

            Oh ccc, your so knowledgeable. Thank you for your continued help.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors