From c4c4ea8e9b9da6e63003b241b9daf9831b49aaad Mon Sep 17 00:00:00 2001 From: d116626 Date: Tue, 4 Oct 2022 18:33:31 -0300 Subject: [PATCH] fix: config_file parametrization --- python-package/basedosdados/upload/base.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python-package/basedosdados/upload/base.py b/python-package/basedosdados/upload/base.py index 543bf0c64..cc58008af 100644 --- a/python-package/basedosdados/upload/base.py +++ b/python-package/basedosdados/upload/base.py @@ -43,10 +43,10 @@ def __init__( config_path = ( config.project_config_path if config.project_config_path is not None - else config_path + else Path.home() / config_path ) - self.config_path = Path.home() / config_path + self.config_path = config_path self._init_config(force=overwrite_cli_config) self.config = self._load_config() self._config_log(config.verbose) @@ -199,7 +199,7 @@ def _init_config(self, force): config_file = self.config_path / "config.toml" # Create credentials folder - credentials_folder = Path.home() / self.config_path / "credentials" + credentials_folder = self.config_path / "credentials" credentials_folder.mkdir(exist_ok=True, parents=True) # Create template folder @@ -259,7 +259,7 @@ def _init_config(self, force): ############# STEP 2 - CREDENTIALS PATH ###################### - credentials_path = Path.home() / ".basedosdados" / "credentials" + credentials_path = self.config_path / "credentials" credentials_path = Path( self._selection_yn( first_question=( @@ -335,7 +335,7 @@ def _init_config(self, force): ############# STEP 6 - SET TEMPLATES ####################### - c_file["templates_path"] = str(Path.home() / ".basedosdados" / "templates") + c_file["templates_path"] = str(self.config_path / "templates") config_file.open("w", encoding="utf-8").write(tomlkit.dumps(c_file)) @@ -360,7 +360,7 @@ def _load_config(self): if getenv(constants.ENV_CONFIG.value): return tomlkit.parse(self._decode_env(constants.ENV_CONFIG.value)) return tomlkit.parse( - (Path.home() / ".basedosdados" / "config.toml") + (self.config_path / "config.toml") .open("r", encoding="utf-8") .read() )