Avoiding exceptions when populating XSICollections


Use the Items property. You won’t get any errors, you just have to check whether or not the collection is empty.

import win32com.client

oColl = win32com.client.Dispatch("XSI.Collection")
oColl.Unique = True
oColl.Items = "*.*.dontexist_*"
print oColl.Count

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s