Skip to content

retrieve_eurostat_household_data permission error on Windows #1818

@Eric-Nitschke

Description

@Eric-Nitschke

Version Checks (indicate both or one)

  • I have confirmed this bug exists on the lastest release of PyPSA-Eur.

  • I have confirmed this bug exists on the current master branch of PyPSA-Eur.

Issue Description

When running retrieve_eurostat_household_data PyPSA-Eur outputs a Permission Error on Windows. This is likely due to the changes introduced in Commit ed5f15c (PR #1768), where a tempfile is created and then opened again. This is not supported on Windows.

INFO:__main__:Downloading Eurostats' disaggregated household energy balances data from 'https://ec.europa.eu/eurostat/databrowser-backend/api/extraction/1.0/LIVE/false/sdmx/csv/nrg_d_hhq__custom_11480365?startPeriod=2013&endPeriod=2022&i&compressed=true'.
INFO:__main__:Using temporary file: C:\[...]\AppData\Local\Temp\tmprdl9eqyw.gz
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "C:\[...]\.snakemake\scripts\tmp1j1s84n0.retrieve_eurostat_household_data.py", line 45, in <module>
    progress_retrieve(
  File "C:\[...]\scripts\_helpers.py", line 417, in progress_retrieve
    with open(file, "wb") as f:
         ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\[...]\\AppData\\Local\\Temp\\tmprdl9eqyw.gz'

EDIT:
This also applies to retrieve_eurostat_data.

Reproducible Example

snakemake -call solve_sector_networks

Expected Behavior

The rule should download the files without failing

Installed Versions

Details Replace this line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions