Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #86 from psyfood/config
Browse files Browse the repository at this point in the history
BF: Handle non-existent configuration path
  • Loading branch information
ArndalAndersen authored Apr 29, 2019
2 parents 839b638 + acfd711 commit 2be7f69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 2019.1
------------------
* Handle non-existent configuration directory

Version 2018.12.13
------------------
* Update installation instructions
Expand Down
9 changes: 9 additions & 0 deletions pyqmix/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ def get_available_qmix_configs(configs_dir=None):
list of strings
Names of available Qmix configurations.
Raises
------
ValueError
If the configuration directory does not exist.
"""
if configs_dir is None:
configs_dir = DEFAULT_CONFIGS_DIR
Expand All @@ -100,6 +105,10 @@ def get_immediate_subdirectories(a_dir):
return [name for name in os.listdir(a_dir)
if os.path.isdir(os.path.join(a_dir, name))]

if not os.path.exists(configs_dir):
msg = 'The configuration directory does not exist: %s' % configs_dir
raise ValueError(msg)

return get_immediate_subdirectories(configs_dir)


Expand Down

0 comments on commit 2be7f69

Please sign in to comment.