Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OMPython/om_session_omc.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def sendExpression(self, expr: str, parsed: bool = True, raise_on_error: bool =
if not self._re_log_raw:
self._re_log_raw = re.compile(
pattern=r"\s*info = record OpenModelica\.Scripting\.SourceInfo\n"
r"\s*filename = \"(.*?)\",\n"
r"\s*file[nN]ame = \"(.*?)\",\n" # older omc: filename, newer: fileName
r"\s*readonly = (.*?),\n"
r"\s*lineStart = (\d+),\n"
r"\s*columnStart = (\d+),\n"
Expand Down
9 changes: 9 additions & 0 deletions tests/test_OMSessionCmd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

import OMPython


Expand All @@ -18,3 +20,10 @@ def test_isPackage2():


# TODO: add more checks ...


def test_error_message_file():
# omc names the file field of a message filename or fileName (OpenModelica issue 17891)
omcs = OMPython.OMCSessionLocal()
with pytest.raises(OMPython.OMSessionException, match=r"\[bad\.mo:"):
omcs.sendExpression('loadString("model M Real x = ; end M;", "bad.mo")')
Loading