Skip to content

Commit 9312f6a

Browse files
committed
Error handling for getClassNames
- Print error messages if omc.sendExpression failes - Fix links in README.md - Add missing NeuralNetwork to install script
1 parent 2bee597 commit 9312f6a

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

.CI/installLibraries.mos

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ for l in {
7777
{"Modelica_Synchronous", "master"},
7878
{"ModelicaByExample", "master"},
7979
{"ModelicaTestOverdetermined", "master"},
80+
{"NeuralNetwork", "main"},
8081
{"ObjectStab", "master"},
8182
{"OpenHydraulics", "main"},
8283
{"OpenIMDML", "main"},

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ defining `MSLREFERENCE` and `REFERENCEFILES`.
187187

188188
Some result file locations:
189189

190-
- Modelica Association: [https://github.com/modelica/MAP-LIB_ReferenceResults](modelica/MAP-LIB_ReferenceResults)
191-
- PNLib: [https://github.com/AMIT-HSBI/PNlib](AMIT-HSBI/PNlib)
192-
- DLR-SR: [https://github.com/DLR-SR/ThermoFluidStream-Regression](DLR-SR/ThermoFluidStream-Regression)
193-
and [https://github.com/DLR-SR/PlanarMechanics_ReferenceResults](DLR-SR/PlanarMechanics_ReferenceResults)
190+
- Modelica Association: [modelica/MAP-LIB_ReferenceResults](https://github.com/modelica/MAP-LIB_ReferenceResults)
191+
- PNLib: [AMIT-HSBI/PNlib](https://github.com/AMIT-HSBI/PNlib)
192+
- DLR-SR: [DLR-SR/ThermoFluidStream-Regression](https://github.com/DLR-SR/ThermoFluidStream-Regression)
193+
and [DLR-SR/PlanarMechanics_ReferenceResults](https://github.com/DLR-SR/PlanarMechanics_ReferenceResults)
194194

195195
To download the MSL reference files create a file
196196
installReferenceResults.sh with

test.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,10 @@ def hashReferenceFiles(s):
665665

666666
try:
667667
omc.sendExpression('loadModel(%s,%s%s)' % (lib,versions,exactMatch))
668-
except OMCSessionException:
669-
try:
670-
print("Failed to load library %s %s: %s" % (library,versions,omc.sendExpression('OpenModelica.Scripting.getErrorString()')))
671-
except:
672-
print("Failed to load library %s %s. OpenModelica.Scripting.getErrorString() failed..." % (library,conf["libraryVersion"]))
668+
except OMCSessionException as e:
669+
print("Failed to load library %s %s" % (library,versions))
670+
print(e)
671+
673672
# adrpo: do not sort the top level names as sometimes that loads a bad MSL version
674673
# conf["loadFiles"] = sorted(omc.sendExpression("{getSourceFile(cl) for cl in getClassNames()}"))
675674
conf["loadFiles"] = omc.sendExpression("{getSourceFile(cl) for cl in getClassNames()}")
@@ -728,7 +727,13 @@ def hashReferenceFiles(s):
728727
if conf.get("fmi") and fmisimulatorversion:
729728
conf["libraryVersionRevision"] = conf["libraryVersionRevision"] + " " + fmisimulatorversion.decode("ascii")
730729
conf["libraryLastChange"] = conf["libraryLastChange"] + " " + fmisimulatorversion.decode("ascii")
731-
res=omc.sendExpression('{c for c guard isExperiment(c) and not regexBool(typeNameString(x), "^Modelica_Synchronous\\.WorkInProgress") in getClassNames(%s, recursive=true)}' % library)
730+
res = []
731+
try:
732+
res = omc.sendExpression('{c for c guard isExperiment(c) and not regexBool(typeNameString(x), "^Modelica_Synchronous\\\\.WorkInProgress") in getClassNames(%s, recursive=true)}' % library)
733+
except OMCSessionException as e:
734+
print("Failed to get class names of library %s", library)
735+
print(e)
736+
732737
if conf.get("ignoreModelPrefix"):
733738
if isinstance(conf["ignoreModelPrefix"], list):
734739
prefixes = conf["ignoreModelPrefix"]

0 commit comments

Comments
 (0)