Skip to content

Commit

Permalink
Check for configFile parameter. Give error and example if not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
carl-drews committed Jul 13, 2024
1 parent 3c4a16d commit ff332ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/acom_music_box/music_box_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def main():
logger.info("Command line = {}".format(myArgs))

# set up the home configuration file
musicBoxConfigFile = "music-box\\tests\\configs\\analytical_config\\my_config.json" # default
musicBoxConfigFile = None
if ("configFile" in myArgs):
musicBoxConfigFile = myArgs.get("configFile")

Expand All @@ -62,6 +62,13 @@ def main():
if ("outputDir" in myArgs):
musicBoxOutputDir = myArgs.get("outputDir")

# check for required arguments and provide examples
if (musicBoxConfigFile is None):
errorString = "Error: The configFile parameter is required."
errorString += (" Example: configFile={}"
.format(os.path.join("tests", "configs", "analytical_config", "my_config.json")))
raise Exception(errorString)

# create and load a MusicBox object
myBox = MusicBox()
myBox.readConditionsFromJson(musicBoxConfigFile)
Expand Down

0 comments on commit ff332ca

Please sign in to comment.