Skip to content

Commit

Permalink
Merge pull request #89 from qutech/bugfix/load_db
Browse files Browse the repository at this point in the history
Load_db() will now created a new database when a valid path is provided
  • Loading branch information
THuckemann authored Apr 24, 2024
2 parents bcf1795 + 813c590 commit a7da266
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/qumada/utils/load_from_sqlite_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,19 @@ def load_db(filepath: str | None = None) -> None:
None.
#TODO: Checks only whether provided path is a file but not which type.
"""
if not filepath or not path.isfile(filepath):
if not filepath:
filetypes = (("DB Files", "*.db*"), ("All files", "*.*"))
filepath = browsefiles(filetypes=filetypes)
if filepath == "":
return None
try:
qc.initialise_or_create_database_at(filepath)
return None
except Exception:
print("Please provide a valid path")
return load_db(None)
elif not path.isfile(filepath):
try:
qc.initialise_or_create_database_at(filepath)
print("Created new Database")
return None
except Exception as e:
print("Please provide a valid path")
raise e


# %%
Expand Down

0 comments on commit a7da266

Please sign in to comment.