Skip to content

Commit 8f38def

Browse files
committed
[OMCSessionZMQ] more generic definiton for omcpath_tempdir()
1 parent 1de0e3b commit 8f38def

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
@@ -523,18 +523,17 @@ def omcpath(self, *path) -> OMCPath:
523523

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

536531
if tempdir_base is None:
537-
tempdir_str = self.sendExpression("getTempDirectoryPath()")
532+
# fallback solution for Python < 3.12; a modified pathlib.Path object is used as OMCPath replacement
533+
if sys.version_info < (3, 12):
534+
tempdir_str = tempfile.gettempdir()
535+
else:
536+
tempdir_str = self.sendExpression("getTempDirectoryPath()")
538537
tempdir_base = self.omcpath(tempdir_str)
539538

540539
tempdir: Optional[OMCPath] = None

0 commit comments

Comments
 (0)