I have a Python script that returns a scan result with scanForNetworksWithName using CoreWLAN with PyObjC. It provides info on ssid and such like the airport command.
When upgrading to MacOS 14.4 however SSID is now Null. I read this was due to changes in permissions and location services needed to be enabled.
I have enabled access to location services and I am able to use CoreLocation to get a location however I still do now see the SSID.
Here is my script, that does both location and scan:
import CoreWLAN
import CoreLocation
from time import sleep
import re
wifi_interface = CoreWLAN.CWInterface.interface()
networks, error = wifi_interface.scanForNetworksWithName_error_(None, None)
location_manager = CoreLocation.CLLocationManager.alloc().init()
location_manager.startUpdatingLocation()
max_wait = 60
# Get the current authorization status for Python
for i in range(1, max_wait):
authorization_status = location_manager.authorizationStatus()
if authorization_status == 3 or authorization_status == 4:
print("Python has been authorized for location services")
break
if i == max_wait-1:
exit("Unable to obtain authorization, exiting")
sleep(1)
coord = location_manager.location().coordinate()
lat, lon = coord.latitude, coord.longitude
print("Your location is %f, %f" % (lat, lon))
print(f"{'SSID' : >32} {'BSSID' : <17} RSSI CHANNEL HT CC SECURITY")
for i in networks:
print(f"{'SSID' : >32} {'BSSID' : <17} RSSI CHANNEL HT CC SECURITY")
for i in networks:
print(f"{i.ssid() or '' : >32} {i.bssid() or '' : <17} {i.rssiValue() : <4} {i.channel() : <6}")
It worked fine in MacOS 13.6 but with MacOS 14.4 I have the null SSID issue.
We went through something similar with MacOS 10.15 where BSSID became Null. At the time I couldn't find a workaround, but sometime around MacOS 13.x I was able to generate the request for location services. After granting the request I was able to see BSSID again. It seems like we have a similar bug to this again.
Thread about the BSSID issue: https://github.com/ronaldoussoren/pyobjc/issues/484