I am in the process of writing a python script to determine projects that reference a given project and have come across Understand from Scitools. After research on the Understands Python API it appears that I need to “open” a DB in order to execute any commands and discover all there is to discover about a given project. For example when I execute this:
example.pyimport understand
import sys
def sortedEntities(db):
for ent in sorted(db.ents(),key= lambda ent: ent.name()):
print (ent.name()," [",ent.kindname(),"]",sep="",end="\n")
if __name__ == '__main__':
# Open Database
args = sys.argv
db = understand.open(args[1])
sortedEntities(db)
I am faced with an understand.UnderstandError: DBCorrupt error because I am not feeding in a .udb file and instead feeding in a .csproj file. I assume then that I have to create this .udb file which is a db file.
I am trying to avoid using Understands GUI and automate this static tool within a python script. Is there any way I can create a DB from a given project and then execute the many commands Understand has to offer. Any guidance would be very much appreciated!