Skip to content

Commit 4b01e00

Browse files
committed
[ModelicaSystem] fix mypy - plot_result_file could be None
1 parent 35b1d93 commit 4b01e00

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,12 +1163,13 @@ def plot(
11631163
ModelicaSystemError("No resultfile available - either run simulate() before plotting "
11641164
"or provide a result file!")
11651165

1166-
if not plot_result_file.is_file():
1166+
if plot_result_file is None:
1167+
ModelicaSystemError("No resultfile defined!")
1168+
elif not plot_result_file.is_file():
11671169
ModelicaSystemError(f"Provided resultfile {repr(plot_result_file.as_posix())} does not exists!")
1168-
1169-
expr = f'plot({plotdata}, fileName="{plot_result_file.as_posix()}")'
1170-
1171-
self.sendExpression(expr=expr)
1170+
else:
1171+
expr = f'plot({plotdata}, fileName="{plot_result_file.as_posix()}")'
1172+
self.sendExpression(expr=expr)
11721173

11731174
def getSolutions(
11741175
self,

0 commit comments

Comments
 (0)