Forum Archive

module location doesn't seem to work

upwart

I am new to Pythonista and learning every day more about this wonderful app.

I am trying to use location.get_location(), but all I get is None.
I know that I should allow Pythonista to use the location, but I never got the question for permission. Also, I can't see Pythonista in the list of apps with/without access to location services in Privacy/Location Services setting.

Please advise.

ccc

Does this work?

import location, time

def getLocation():
    location.start_updates()
    time.sleep(1)  # give GPS hardware a second to wake up
    currLoc = location.get_location()
    location.stop_updates()  # stop GPS hardware ASAP to save battery
    return currLoc

print(getLocation())
upwart

Yes, this works! Thank you very much.