Skip to content

Commit 6328a17

Browse files
committed
[OMCSessionZMQ] more generic definiton for omcpath_tempdir()
1 parent 63042fb commit 6328a17

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

OMPython/OMCSession.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,18 +526,17 @@ def omcpath(self, *path) -> OMCPath:
526526

527527
def omcpath_tempdir(self, tempdir_base: Optional[OMCPath] = None) -> OMCPath:
528528
"""
529-
Get a temporary directory using OMC.
529+
Get a temporary directory using OMC. It is our own implementation as non-local usage relies on OMC to run all
530+
filesystem related access.
530531
"""
531-
# fallback solution for Python < 3.12; a modified pathlib.Path object is used as OMCPath replacement
532-
if sys.version_info < (3, 12):
533-
tempdir_str = tempfile.gettempdir()
534-
# noinspection PyArgumentList
535-
return OMCPath(tempdir_str)
536-
537532
names = [str(uuid.uuid4()) for _ in range(100)]
538533

539534
if tempdir_base is None:
540-
tempdir_str = self.sendExpression("getTempDirectoryPath()")
535+
# fallback solution for Python < 3.12; a modified pathlib.Path object is used as OMCPath replacement
536+
if sys.version_info < (3, 12):
537+
tempdir_str = tempfile.gettempdir()
538+
else:
539+
tempdir_str = self.sendExpression("getTempDirectoryPath()")
541540
tempdir_base = self.omcpath(tempdir_str)
542541

543542
tempdir: Optional[OMCPath] = None

0 commit comments

Comments
 (0)