Skip to content

Commit 1acd916

Browse files
committed
[OMCPath] define limited compatibility for Python < 3.12
* use modified pathlib.Path as OMCPath
1 parent c23e57f commit 1acd916

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

OMPython/OMCSession.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,15 @@ def size(self) -> int:
416416
raise OMCSessionException(f"Error reading file size for path {self.as_posix()}!")
417417

418418

419+
if sys.version_info < (3, 12):
420+
class OMCPathCompatibility(pathlib.Path):
421+
422+
def size(self) -> int:
423+
return self.stat().st_size
424+
425+
426+
OMCPath = OMCPathCompatibility
427+
419428

420429
class OMCSessionZMQ:
421430

0 commit comments

Comments
 (0)