Skip to content

Permission error when downloading DISP-S1 products on Windows due to NamedTemporaryFile handling #224

Description

@dinukem

Description
I am currently working on integrating OPERA DISP-S1 product downloads into an ArcGIS Toolbox workflow and encountered a download issue when running opera-utils on Windows.

During the DISP-S1 download step, the process fails with a permission-related error associated with the temporary NetCDF file handling.

Location of issue
The issue appears to originate from:
src/opera_utils/disp/_download.py

specifically:
with tempfile.NamedTemporaryFile(suffix=".nc") as tf:

Proposed fix
Changing the temporary file creation to:

with tempfile.NamedTemporaryFile(
suffix=".nc",
delete=True,
delete_on_close=False
) as tf:

resolves the issue and allows the DISP-S1 download workflow to complete successfully on Windows.

This appears to be related to how Windows handles access to open named temporary files, where the file cannot always be reopened by another process while the original handle remains active.

Would it be possible to integrate this change (or a similar Windows-compatible temporary file handling approach) into opera-utils so the fix becomes available through the PyPI/conda-forge releases?

This would allow downstream tools, including ArcGIS Toolbox integrations, to use the standard packaged version of opera-utils without requiring local modifications.

Thank you for maintaining this package.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions