From 5acda0fa226293ee51cefe2e582e13c824683113 Mon Sep 17 00:00:00 2001 From: Ugo Date: Mon, 3 May 2021 23:58:12 +0200 Subject: [PATCH] fixed small bug --- pybindmagic/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pybindmagic/__init__.py b/pybindmagic/__init__.py index d9015e6..13579b0 100644 --- a/pybindmagic/__init__.py +++ b/pybindmagic/__init__.py @@ -174,8 +174,9 @@ def cpp(line, cell, *what): # otherwise we import all names that don't begin with _ names = [x for x in mdl.__dict__ if not x.startswith("_")] except Exception as e: - with open(os.path.join(cmake_path,"CMakeLists.txt"), 'w') as f: - f.write(cmake) + if cmake_path is not None: + with open(os.path.join(cmake_path,"CMakeLists.txt"), 'w') as f: + f.write(cmake) if os.path.exists(os.path.join(path,f"{name}.cpp")): os.remove(os.path.join(path,f"{name}.cpp")) raise e