summaryrefslogtreecommitdiff
path: root/scripts/database/database.py
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-12-20 19:14:04 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-12-20 19:14:04 +0100
commitc6806662509575fd33de9f7d75f0d8df5f874473 (patch)
tree84a35ef29949a402074422e45b6e3d62c6999f52 /scripts/database/database.py
parente2f8068459579d4d094386d7d3215153e430cb25 (diff)
Added try-except to database script parser to skip invalid files
Diffstat (limited to 'scripts/database/database.py')
-rwxr-xr-xscripts/database/database.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/scripts/database/database.py b/scripts/database/database.py
index 28f6ebf8..57fbf74a 100755
--- a/scripts/database/database.py
+++ b/scripts/database/database.py
@@ -106,16 +106,20 @@ def main(argv):
# Loops over all JSON files in the supplied folder
for file_json in glob.glob(json_files):
-
- # Loads the newly imported data
sys.stdout.write("[database] Processing '" + file_json + "' ") # No newline printed
- imported_data = io.load_tuning_results(file_json)
- # Adds the new data to the database
- old_size = db.length(database)
- database = db.add_section(database, imported_data)
- new_size = db.length(database)
- print("with " + str(new_size - old_size) + " new items") # Newline printed here
+ try:
+ # Loads the newly imported data
+ imported_data = io.load_tuning_results(file_json)
+
+ # Adds the new data to the database
+ old_size = db.length(database)
+ database = db.add_section(database, imported_data)
+ new_size = db.length(database)
+ print("with " + str(new_size - old_size) + " new items") # Newline printed here
+
+ except ValueError:
+ print("--- WARNING: invalid file, skipping")
# Checks for tuning results with mis-matched entries
remove_mismatched_arguments(database)