Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4169

Python • Re: Network Manager fix for Debian Buster

$
0
0
then, you'll have to fixup the module for your use case as i did, i would start by changing that if/else of addr_to_python to a try/except
Hi alfrix.
Sorry to bother again but you're the only one I know that seems to know their way around NetworkManager.py.
I've tried multiple approaches to eliminate the errors in my code but with no success, I've tried a modified version of addr_to_python() function like this:

Code:

def addr_to_python(addr, family):        try:            if family == socket.AF_INET:                # Convert IP address string to packed binary format                packed_addr = socket.inet_aton(addr)                # Use struct.pack to pack the binary address into a packed string                packed_string = struct.pack('I', struct.unpack('!I', packed_addr)[0])                # Convert the packed string back to a human-readable format                return socket.inet_ntop(family, packed_string)        except:            return socket.inet_ntop(family, b''.join(addr))
The error goes away there, (the except condition also fails) but then while passing the SSID to the settings they don't seem to be decoded from their dbus.Byte(x) format:

Code:

({'802-11-wireless': {'band': 'bg', 'mode': 'ap', 'ssid': [dbus.Byte(74), dbus.Byte(76), dbus.Byte(65), dbus.Byte(45)...
As of my understanding this should be happening in the ssid_to_python function so no idea why it isn't working...
Can you offer some further guidance on this issue?

Thank you for the assistance!

Statistics: Posted by gabriel_sapinto — Wed Mar 06, 2024 5:56 pm



Viewing all articles
Browse latest Browse all 4169

Trending Articles