[python-win32] GetNetworkConnections fails since a Windows update
cwalou at gmail.com
cwalou at gmail.com
Wed May 3 10:00:13 EDT 2023
Hello.
After a recent update on Windows 10, I not able to tell exactly which,
I've a strange behavior on a program that works fine since 2015 on
thousands of machines...
* With this code :
def networks_private():
NETWORK_CATEGORIES = {1: "PRIVATE",0: "PUBLIC", 2: "DOMAIN"}
m = win32com.client.Dispatch("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")
more = 1
pos = 1
connections = m.GetNetworkConnections()
while more:
connection, more = connections.Next(pos)
if connection:
network = connection.GetNetwork()
category = network.GetCategory()
try:
log('switching network interface in private mode')
network.SetCategory(1)
except:
log("error switching network interface in private mode")
pos += 1
* I get this error :
Traceback (most recent call last):
[...]
File "Frame1.pyo", line 163, in _init_
File "fonctions.pyo", line 201, in networks_private
File "win32com\client\dynamic.pyo", line 522, ingetattr_
AttributeError: Next.GetNetwork
Regards, thanks.
More information about the python-win32
mailing list