Skip to content

Commit

Permalink
fix problem with config dir creation during setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pmayd committed Oct 29, 2023
1 parent 28e8f4c commit f94093c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/pystatis/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ def write_config(config_file: Path | None = None) -> None:
if not config_file.parent.exists():
config_file.parent.mkdir(parents=True)

cache_dir = Path(get_cache_dir())
if not cache_dir.exists():
cache_dir.mkdir()

with open(config_file, "w", encoding="utf-8") as fp:
config.write(fp)

Expand Down Expand Up @@ -134,11 +138,8 @@ def create_default_config() -> ConfigParser:
"doku": "https://ergebnisse2011.zensus2022.de/datenbank/misc/ZENSUS-Webservices_Einfuehrung.pdf",
}

config["DATA"] = {"cache_dir": str(Path(CUSTOM_CONFIG_DIR) / "data")}

cache_dir = Path(config["DATA"]["cache_dir"])
if not cache_dir.exists():
cache_dir.mkdir()
cache_dir = Path(CUSTOM_CONFIG_DIR) / "data"
config["DATA"] = {"cache_dir": str(cache_dir)}

return config

Expand Down

0 comments on commit f94093c

Please sign in to comment.