Hello,
Here's the scenario:
1. A for loop in a python script is used to cycle through and print out the name of the Library References in a python script using the Library Manager "references" property.
If a Library Reference.is_managed property is true, and if the version of that library that is set in the Library Manager is not installed on the machine, the the script fails with "Object reference not set to an instance of an object."
code#This is an excerpt from the code.#The error occurs when trying to access displayname property on the last line.libraryReferences = applicationLevel_scriptObject.referencesfor libraryReference in libraryReferences: if libraryReference.is_managed: print("-> %s" % (libraryReference.managed_library.displayname) ) #print the names of managed library references
How can I detect this error, so that I can handle it gracefully in my script?
I've tried checking the follwoing, but none of them works:
libraryReference != NULL
libraryReference != Empty
isinstance(libraryReference, ScriptLibraryReference)
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Here's the scenario:
1. A for loop in a python script is used to cycle through and print out the name of the Library References in a python script using the Library Manager "references" property.
How can I detect this error, so that I can handle it gracefully in my script?
I've tried checking the follwoing, but none of them works:
libraryReference != NULL
libraryReference != Empty
isinstance(libraryReference, ScriptLibraryReference)
Thanks!