From 044d0d5b81b2b2fcbc2ba1280fdfb7b08cc36389 Mon Sep 17 00:00:00 2001 From: Simon Birkholz Date: Tue, 25 Feb 2025 11:25:54 +0100 Subject: [PATCH] fix: now handle str as well as pathlib.Path for __init__ in SessionFile --- cuvis/SessionFile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cuvis/SessionFile.py b/cuvis/SessionFile.py index 7cf1e17..0d3a7f4 100644 --- a/cuvis/SessionFile.py +++ b/cuvis/SessionFile.py @@ -1,4 +1,4 @@ -import os + from pathlib import Path from ._cuvis_il import cuvis_il @@ -13,11 +13,12 @@ class SessionFile(object): def __init__(self, base: Union[Path, str]): + base = Path(base) self._handle = None self._pc = None - if isinstance(Path(base), Path) and os.path.exists(base): + if base.exists(): _ptr = cuvis_il.new_p_int() - if cuvis_il.status_ok != cuvis_il.cuvis_session_file_load(base, + if cuvis_il.status_ok != cuvis_il.cuvis_session_file_load(str(base), _ptr): raise SDKException() self._handle = cuvis_il.p_int_value(_ptr)