[Sidefx-houdini-list] OperationFailled exception when comparing two node tupes in HOM

Pablo Giménez pablogipi at gmail.com
Fri Oct 30 16:44:51 EDT 2009


Hi, just a quick one about HOM.
I have a snippet of code that basically goes through all the otls files in a
location and check if a given definition exists in the otl.
So I am getting the otls defintions with: hou.hda.definitionsInFile(otl)
The I compare the node types, bascially this is what I am doing:

def getDefinitionInOtl(definition, otl):
    # Get definitions in the otl:
    definitions =  hou.hda.definitionsInFile(otl)
    if len(definitions) == 0:
    raise st.TypeError('Given otl hasn`t any definition: \n' +
otl.libraryFilePath())
    for assetDef in definitions:
    if assetDef.nodeType()  == definition.nodeType():
        return assetDef

    # Not found
    raise st.ValueError("Definition cant be found in the otl:\n" +
otl.libraryFilePath())

Well to make it works I have to change:
if assetDef.nodeType()  == definition.nodeType():
by:
if assetDef.nodeTypeName()  == definition.nodeTypeName():

Sometimes I got an exception of type OperationFailled because the definition
is not installed if I compare two hou.NodeType.
A work around is t ocompare string instead, althoug is not perfect.
My question is why I can compare and get the names of the node types but not
compare both of them.

thx
-- 
Un saludo
Best Regards
Pablo Giménez



More information about the Sidefx-houdini-list mailing list