Querying Com Ports

Hi all,
I have a system which uses a bunch of arduinos and Hokuyo lidars. It’s working great except windows keeps switching my com ports which breaks the application. Is there any way to query available com ports so i can automatically assign hokuyo chop and serial Dat com ports? I can even do a roll call but i need to know which com ports Windows is seeing in order to do that. Thanks for any tips!

Here’s a script to see what com ports windows is seeing:

[code]import winreg
import itertools

path = ‘HARDWARE\DEVICEMAP\SERIALCOMM’
try:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path)
except WindowsError:
raise IterationError
print(‘winerr’)

for i in itertools.count():
try:
val = winreg.EnumValue(key,i)
print(val)
except EnvironmentError:
break[/code]