diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0cf62cdb43921910bc8d68d76498674527ade1d..527a09f8be569421899d80f1b11b1d22de03b269 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,6 @@ default: - .pip-cache/ before_script: - python3 --version - - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - pip3 install --upgrade pip - pip3 install build twine diff --git a/src/dynare/dynare.py b/src/dynare/dynare.py index f1cb45ba45f9726d4c7aa71dc8d6529d833cd5cb..b4888dedef9e530ed491b91eeeb4a192163891e9 100644 --- a/src/dynare/dynare.py +++ b/src/dynare/dynare.py @@ -14,7 +14,9 @@ def dynare(model: str | Path) -> Context: model = Path(model) jl.seval("using Serialization") jl.seval("using Dynare") - jl.seval(f'@dynare "{model.resolve()}"') + # Double-escape '\' as julia will also interpret the string. Only relevant on Windows + resolved_path = str(model.resolve()).replace("\\", "\\\\") + jl.seval(f'@dynare "{resolved_path}"') jls_path = model.parent / model.stem / "output" / f"{model.stem}.jls" diff --git a/src/dynare/dynare_context.py b/src/dynare/dynare_context.py index aa7710c8895a01245ae76f1289ac1d3d2903bca8..a6d5d7db8a1daff269b2ce419756543f88b9582c 100644 --- a/src/dynare/dynare_context.py +++ b/src/dynare/dynare_context.py @@ -746,7 +746,11 @@ class PySGSolver(Enum): ) -TASlib = ctypes.CDLL(os.getenv("LIBTASMANIAN_PATH")) # Load the shared library +libtas_path = os.getenv("LIBTASMANIAN_PATH") +if libtas_path: + TASlib = ctypes.CDLL(libtas_path) # Load the shared library +else: + TASlib = None @dataclass @@ -770,6 +774,8 @@ class PyTasmanianSG: @classmethod def from_julia(cls, jl_tasmaniansg) -> Self: + if not TASlib: + raise ValueError("It looks like Tasmanian is not installed. Please install from https://github.com/ORNL/TASMANIAN and set LIBTASMANIAN_PATH") c_func = getattr(TASlib, "tsgConstructTasmanianSparseGrid") c_func.restype = ctypes.POINTER(ctypes.c_void_p) pGrid = c_func()