pywinrt/python-winsdk

Access is Denied when trying to use GeoLocation

psychoSherlock opened this issue · 5 comments

import winsdk.windows.devices.geolocation as wdg
import asyncio


async def getCoords():
    locator = wdg.Geolocator()
    pos = await locator.get_geoposition_async()
    return [pos.coordinate.latitude, pos.coordinate.longitude]


def getLoc():
    return asyncio.run(getCoords())


getLoc()
PermissionError: [WinError -2147024891] Access is denied
dlech commented

I would check the Windows settings to make sure location services are enabled.

Damn you are fast man. 😂 Silly me. That was the error. I was trying everything.

Also, just another silly doubt. Why does my laptop sometimes show not so accurate location but sometime it does?

Just wanna make sure if its using the hardware or the IP address