[python-win32] Using win32com to access uPNP

Gavin Hotpop gavinrobb at hotpop.com
Mon Mar 21 13:26:14 CET 2005


I saw this on the internet & am having a similar problem - I think. I'm not a technical person, but have worked out that the script I am running errors ->"Object Required" when it reaches the first line that uses mappingports.

Did you manage to fix this - if so please help! I have tried Microsoft & Netgear but nobody seems to want to help.

Thank you,
Gavin


Your message:
Hi --
 
I'm trying to use the interface in win32com to access the windows uPNP
service, the code is as follows:

import win32com.client

theNatter = win32com.client.Dispatch("HNetCfg.NATUPnP")

mappingPorts = theNatter.StaticPortMappingCollection

At this point mappingPorts seems to contain the null object, so it would
appear that theNatter doesn't have an attribute StaticPortMappingCollection
though the msdn docs claim otherwise.

Also, i notice there are a number of interfaces common to HNetCfg.dll and
NATUPnP - how does the above code differntiate between them ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20050321/5bad5d15/attachment.html


More information about the Python-win32 mailing list