Skip to content

Commit f4c6577

Browse files
committed
[bugfix] Fix error in path handling when opening config file from UI #252
1 parent cea454e commit f4c6577

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

docs/changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,5 +391,6 @@ This version of DVR-Scan includes a new, faster background subtraction algorithm
391391

392392
### 1.9
393393

394-
- [general] Minimum Python version is now 3.10 ([EOL](https://devguide.python.org/versions/))
394+
* [general] Minimum Python version is now 3.10 ([EOL](https://devguide.python.org/versions/))
395395
* [bugfix] Fix `quiet-mode` setting (`-q`/`--quiet` flag) still allowing extraneous output
396+
* [bugfix] Fix loading config from file in UI

dvr_scan/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,10 @@ def load(self, path: ty.Optional[Path] = None):
434434
ConfigLoadFailure: The config file being loaded is corrupt or invalid,
435435
or `path` was specified but does not exist.
436436
"""
437+
# Allow passing in str paths for convenience.
438+
if path and not isinstance(path, Path):
439+
path = Path(path)
440+
437441
# Validate `path`, or if not provided, use USER_CONFIG_FILE_PATH if it exists.
438442
if path:
439443
self._log(logging.INFO, "Loading config from file: %s" % path)

dvr_scan/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def parse_settings() -> ty.Optional[ScanSettings]:
9898
init_log += config.consume_init_log()
9999
if hasattr(args, "config"):
100100
config_setting = ConfigRegistry()
101-
config_setting.load(Path(args.config))
101+
config_setting.load(args.config)
102102
init_logging(args, config_setting)
103103
config = config_setting
104104
init_log += config.consume_init_log()

0 commit comments

Comments
 (0)