07-14-2022 01:41 PM
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 in range( 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
07-21-2022 10:45 AM
Please try these examples from my website:
http://www.savvydiadempysolutions.com/index.php?tab=script&topic=dataportal-using-python-in-diadem
07-21-2022 10:49 AM
Mark,
Thanks for your reply. I have already used your website as a reference!
Do you know if there is an official path to submitting a bug report?
Thanks,
Jim
07-22-2022 04:10 AM
Hi carowip,
Yes, you are right, many of the code snippets in the DIAdem help are not working correct. (The installed example files for Python are OK.) I have informed R&D about that. Their feedback is to fix that, but because of the huge number of code snippets it may take more than one release.
Greetings
Walter