Skip to content

Commit 6d64d16

Browse files
fix: windows file permission take 2 (#503)
* Fix windows permission error when dumping model file * Properly use file context when dumping model
1 parent 5c2deec commit 6d64d16

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

linopy/remote/oetc.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,10 @@ def solve_on_oetc(self, model): # type: ignore
495495
"""
496496
try:
497497
# Save model to temporary file and upload
498-
model_dump_path = None
499498
with tempfile.NamedTemporaryFile(prefix="linopy-", suffix=".nc") as fn:
500-
model_dump_path = fn.name
501-
502-
model.to_netcdf(model_dump_path)
503-
input_file_name = self._upload_file_to_gcp(fn.name)
499+
fn.file.close()
500+
model.to_netcdf(fn.name)
501+
input_file_name = self._upload_file_to_gcp(fn.name)
504502

505503
# Submit job and wait for completion
506504
job_uuid = self._submit_job_to_compute_service(input_file_name)

0 commit comments

Comments
 (0)