I love the fact that Python has been added for automating Diadem. However, I have noticed in transition that, annoyingly, many of the Python code examples in Diadem help are incorrect!
I am going to go out on a limb here and say that it seems like NI wrote a VBScript to Python translator for their help examples, and the translator does not work properly.
Worse yet, these example Python scripts must not have been validated. If they were reviewed, loaded into a decent IDE, or run through software testing these errors would have been found. Providing incorrect examples to new Diadem and Python users is a recipe for user frustration.
Here is one example, there are many others scattered throughout the help:
Diadem 2022 Q2 help file, Command: FileNameGet
Selecting several files for any follow-up actions: (two errors, lines 2 and 3):
dd.FileNameGet("ANY", "FileRead", dd.DataReadPath, "TDM data (*.tdm),*.tdm", "All.lst", True, "Data selection") MyFileNames = Split(dd.FileDlgFileName,"|") for iCount inrange( 0, len(MyFileNames) + 1): dd.DataFileLoad(MyFileNames(iCount))
Corrected Python code:
dd.FileNameGet("ANY", "FileRead", dd.DataReadPath, "TDM data (*.tdm),*.tdm", "All.lst", True, "Data selection") MyFileNames = dd.FileDlgFileName.split("|") for iCount in range(len(MyFileNames)): dd.DataFileLoad(MyFileNames[iCount])
Please address these issues in your help files.
Respectfully,
Jim