osx - Using CoreLocation from python on OS X -
i want mac's current location using corelocation apis python. know them invoking command line executables or similar, interested in using corelocation's own python bindings.
so far create class should act delegate , create instance of cllocationmanager
. calling startupdatinglocation()
shows os x's location permission requester, , location icon appears on menu bar, never of delegate methods called. authorizationstatus()
returns 3
, kclauthorizationstatusauthorized
.
what's wrong?
""" core location python test """ import cocoa import corelocation locaitonsearchfinished = false class cltestdelegate(cocoa.nsobject): def locationmanager_didupdatelocations_(self, manager, locations): print u"new location: %s" % locations locaitonsearchfinished = true def locationmanager_didfailwitherror_(self, manager, error): print u"error updating location: %s" % error locaitonsearchfinished = true def locationmanager_didchangeauthorizationstatus_(self, manager, status): print u"status: %s" % status delegate = cltestdelegate.alloc().init() locationmanager = corelocation.cllocationmanager.alloc().init() locationmanager.setdelegate_(delegate) locationmanager.startupdatinglocation() print locationmanager print delegate print corelocation.cllocationmanager.authorizationstatus() while locaitonsearchfinished == false: pass
i added print statement print locationmanager.location() code results.
with : corelocation attributeerror
Comments
Post a Comment