diff --git a/linopy/remote/oetc.py b/linopy/remote/oetc.py index 3beb0017..0a712abd 100644 --- a/linopy/remote/oetc.py +++ b/linopy/remote/oetc.py @@ -495,12 +495,10 @@ def solve_on_oetc(self, model): # type: ignore """ try: # Save model to temporary file and upload - model_dump_path = None with tempfile.NamedTemporaryFile(prefix="linopy-", suffix=".nc") as fn: - model_dump_path = fn.name - - model.to_netcdf(model_dump_path) - input_file_name = self._upload_file_to_gcp(fn.name) + fn.file.close() + model.to_netcdf(fn.name) + input_file_name = self._upload_file_to_gcp(fn.name) # Submit job and wait for completion job_uuid = self._submit_job_to_compute_service(input_file_name)