IFamilyLoadOptions / CPython3 Issue

I’m currently working on a python script that will batch load families . It works as is in IronPython ; however, when I switch to CPython I get a TypeError : interface takes exactly one argument line 58 (the famDoc.LoadFamily(doc,FamilyOption()) line). It appears to be related to the FamilyOption Class, but can’t seem to figure out how to fix it. Any thoughts?

class FamilyOption(IFamilyLoadOptions):
    def OnFamilyFound(self, familyInUse, overwriteParameterValues):
        overwriteParameterValues = True
        return True

    def OnSharedFamilyFound(self, sharedFamily, familyInUse, source, overwriteParameterValues):
        overwriteParameterValues = True
        return True

def ChangeCategory(doc, element, bic):
    # Retrieve the family from the given element
    family = element.Symbol.Family
    famDoc = doc.EditFamily(family)
    ownerFamily = famDoc.OwnerFamily
    # Change the category of the owner family to a new category, in this case, Windows
    ownerFamily.FamilyCategory = Category.GetCategory(famDoc, bic)
    # Define new subcategories to be added to the family
    newSubCats = ["Glass", "Trim", "Frame/Mullion", "Sill/Head", "Panel"]


    subCats = ownerFamily.FamilyCategory.SubCategories
    subCatDict = {}
    for s in subCats:
        subCatDict[s.Name] = s

    for w in newSubCats:
        # Add new subcategory if it does not already exist
        if w not in subCatDict:
                newCat = famDoc.Settings.Categories.NewSubcategory(ownerFamily.FamilyCategory, w)
            except: pass

    # Start a new transaction in the main document to load the modified family
    famDoc.LoadFamily(doc, FamilyOption())

    return ownerFamily

Hi, and welcome,

That should help you get there

Thanks for the reply. I’ll dig into that reference link and see what I can uncover…thanks again.