pypsa-eur icon indicating copy to clipboard operation
pypsa-eur copied to clipboard

configfile argument doesn't override if config.yaml exists

Open blakeldridge opened this issue 4 months ago • 0 comments

Version Checks (indicate both or one)

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

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

Issue Description

If you have config/config.yaml present in your workflow, using --configfile in a snakemake command does not override the config.yaml. Instead it will take on the config.yaml values.

I found this issue by accidently having an empty config.yaml file, which lead to the error : "Config file must be given as JSON or YAML with keys at top level"

To reproduce:

  • create clean copy of pypsa-eur
  • create config.yaml file (leave empty)
  • run the command snakemake -call solve_elec_networks --configfile config/config.default.yaml

This should lead to the error above.

This probably means the snakefile could be changed:

if Path("config/config.yaml").exists():

    configfile: "config/config.yaml"

Needs to instead check if an arguement is passed for configfile, otherwise it checks if config.yaml exists

Reproducible Example

Mentioned above

Expected Behavior

Mentioned Above

Installed Versions

Replace this line.

blakeldridge avatar Aug 19 '25 10:08 blakeldridge