From ba17a0b781c5546494839e6b70e8bd1133ce1fa7 Mon Sep 17 00:00:00 2001 From: Zane Starr Date: Thu, 14 Mar 2024 20:09:20 -0700 Subject: [PATCH] fix: use dill instead of pickle to support lambda --- cadCAD/engine/execution.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cadCAD/engine/execution.py b/cadCAD/engine/execution.py index 0dbac770..2d8993ef 100644 --- a/cadCAD/engine/execution.py +++ b/cadCAD/engine/execution.py @@ -6,6 +6,7 @@ from cadCAD.utils import flatten import tempfile import pickle +import dill VarDictType = Dict[str, List[object]] StatesListsType = List[dict[str, object]] @@ -69,7 +70,7 @@ def process_executor(params): )] temp_file = tempfile.NamedTemporaryFile(delete=False) with open(temp_file.name, 'wb') as f: # Note 'wb' for binary writing mode - pickle.dump(result, f) + dill.dump(result, f) return temp_file.name @@ -77,7 +78,7 @@ def file_handler(filenames: List[str]) -> List: combined_results = [] for file_name in filenames: with open(file_name, 'rb') as f: # Note 'rb' for binary reading mode - result = pickle.load(f) + result = dill.load(f) combined_results.append(result) result = None f.close()